Here’s a script I wrote awhile ago. It parses an example of how you want your date/time values formatted, and builds a format string you can pass to date() or strftime(). Soon after I wrote it, I posted it to reddit, and I don’t think anyone understood it because they all modded me down for it. I ended up removing it to save my karma. As if that matters. Anyway, it is useful, and I still use it from time to time. Much less work than consulting the manual.
If you want the source code, drop me a line.