Hacker News new | past | comments | ask | show | jobs | submit login

The point is that in order to remember the order that the dates should be put in, you need to remember google's 'reference' layout .. Jan 2 15:04:05 2006 MST ... in other words:

1) Month, 2) Day of Month, 3) Hour, 4) Minute, 5) Second, 6) Year

So yes, you DO need to remember that the numbers are 'month/day' ordered, in order to, from memory, derive that it's 2006-01-02, and not 2006-02-01. With strftime, we effectively standardised "%Y-%m-%d"




> google's 'reference' layout

Nothing to do with Google here, by the way. It's just the default format of the Unix date command.

So if you can't remember the order, just switch to your shell and run `LC_ALL=C date`.


Not quite. With date, the timezone comes before the year.

LC_ALL=C date => Sun Feb 13 14:27:18 GMT 2022




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: