strftime hints on the command line.
npm install reverse-strftimeStrftime directives on the command line. Pass in a date, get back a strftime string.

Must be installed globally (so it's available from the command line).
``bashyarn
yarn global add reverse-strftime
Usage
In the console, input your desired date format:
strftime [date string] (options)`bash
strftime Saturday January 1, 2020
➜ %A %B %e, %Y
strftime Sat. Jan. 01, 20
➜ %a. %b. %d %y
strftime 4/4/21
➜ %m/%e/%y
strftime 4-04-2021
➜ %m-%d-%Y
strftime Mon. January 1, 2044 14:40:45
➜ %a. %B %e, %Y %H:%M:%S
strftime 4/4/4444 4:40:45 am
➜ %m/%e/%Y %l:%M:%S %P
`$3
By default, the input string is parsed using the system locale. See the
and options below for using locales other than your own.`bash
System locale: es-MX
strftime Thursday, 20 May 2021 01:20:12
➜ %A, %d %B %Y %H:%M:%S
`Options
$3
(Requires Node > v12)
Indicate if your input order differs from the system locale's. e.g. You're in the US, but are putting the day first.
strftime [datestring] -l --locale`bash
System locale => en-US (M/D/YYYY)
Let's generate a string for en-GB (D/MM/YYYY)
strftime Mon. 31/12/1999 -l en-GB
➜ %a. %d/%m/%Y
Same input without padding a locale will give incorrect output.
strftime Mon. 31/12/1999
➜ %a. %m/%d/%Y (Nope)
`$3
Auto generate strftime string.
Optionally pass in a locale (see above) to generate for another locale.
strftime -a --auto`bash
locale: en-US
strftime -a
➜ %A, %B %d, %Y at %H:%M:%S %p
➜ Monday, May 17, 2021 at 23:34:26 PM
Let's autogenerate for another locale
strftime -a -l en-GB
➜ %A, %d %B %Y at %H:%M:%S
`$3
When autogenerating, prefer short-format.
strftime -a -s --short`bash
strftime -a -s
➜ %m/%d/%y, %H:%M %p
`Reference
Use the reference command to log all the strftime keys.
strftime reference|ref`bash
strftime refLogs:
➜ Weekday
%A Sunday
%a Sun
#
➜ Month
%B August
%b Aug
%m 08
...
`Usage Notes
$3
As usual, you can combine commands
`bash
strftime -asl en-GB
➜ %d/%m/%Y, %H:%M
`$3
The date does not have to be accurate, only recognizable. i.e. you don't have to think about the date (just the format).
`bash
New Year's Eve in 1999 was actually a Friday,
but this still prints the correct strftime:
strftime Sunday December 31, 1999
➜ %A %B %d, %Y
`$3
reverse-strftime mostly expects full dates, or at least partial dates in order.
`bash
This is fine
strftime June 1
➜ %B %e
But it'll bonk if time is added and
year is skipped:
strftime June 1 4pm
➜ %B %e %y%P
``