3 ms·
It's there: > This not only makes all of the dates look equally nice, but also, coupled with other quirks of this format, allows the files with the date in the
by eesmith 6y ago
It's there:
> This not only makes all of the dates look equally nice, but also, coupled with other quirks of this format, allows the files with the date in the name to be sorted just by the filename.
My issue is with:
> Simplified, the core date format looks like this: yyyy-mm-dd hh:mm:ss
Here are the examples at https://en.wikipedia.org/wiki/ISO_8601 https://en.wikipedia.org/wiki/ISO_8601
2021-02-26T06:22:59+00:00
2021-02-26T06:22:59Z
20210226T062259Z
Note the "T" instead of a space between the date and time? That's what the spec says: https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_tim... . "Separating date and time parts with other characters such as space is not allowed in ISO 8601, but allowed in its profile RFC 3339."
Note the optional use of "-" and ":"? That's "basic" vs. "extended" formats.
Plus the optional timezone specifier (if not present, assume it's the same timezone).
There's also optional support for microseconds.
- kirbykevinson 6y agoI omitted this detail on purpose to not distract the reader who doesn't know much about date formats.
- eesmith 6y agoHow would you describe the accuracy and veracity of > "Here there’s only one correct way to write a date," given that there are multiple correct ways, and the way shown wasn't actually ISO 8601 but RFC 3339?
- kirbykevinson 6y agoYes, technically there are some edge cases where you can write things differently (apart from what you mentioned, one is, for example, writing the UTC time zone by Z vs +00:00 and another is adding additional precision to the date), but for the end user it's basically the same. Let's not ruin the illusion here :)
- eesmith 6y agoThere's nothing wrong with leading with something like: ISO 8601 is a complex specification because of the many different ways to describe times, dates and duration. Don't let that complexity throw you off! The ISO 8601 timestamp format is clean and elegant. These examples will use the widely used ISO 8601 profile known as RFC 3339, which I'll refer to simply as "ISO 8601". No need for an illusion when synecdoche works.
- mjevans 6y agoI loath the T and Z characters, so respectively I use a single dash (Between the date and time) and no Z; for time I often leave in the colons (:). Example: 20210226-00:01:25 this presents the data in a format I can easily visually parse and also easily search for useful things in log files with. When parsing such a date I tend to throw out all of the characters, but the 'Zulu' or timezone at the end probably should be parsed in anything that isn't a trivial internal use.
- eurasiantiger 6y agoIn other words, you are not using a standard format.
- mjevans 6y agoI think of it as a modified form of the standard format, where the standard format doesn't fulfill the needs of my use case.
- bhaak 6y agoI find it impressing that you can easily parse 20210226-00:01:25. The time is of course no problem but even with "20210226" standalone, I stumble and misread 10 and 22 before noticing that this doesn't parse. If there are more zeros and more 1's or 2's, it gets even worse. I hate it that the migrations in Rails are numbers only. "db/migrate/20210218125920_add_new_column.rb" is simply not human parseable.
- apricot 6y agoWhen I visited China, I saw 11-digit phone numbers commonly written without any punctuation or spaces: like 12020569031. I guess you can get used to it.
- guiraldelli 6y agoSpot on: I came here to make this comment about ISO 8601 vs. RFC 3339 and point-out that "European format" is a generalisation, not a rule: Lithuania [1] and Sweden use the ISO 8601 for date representation, and Portugal and Spain uses dd/mm/yyyy. I must say I just saw the dd.mm.yyyy used in Italy, but it seems that a few other countries also use it. (And EU requires dd/mm/yyyy in "best before" dates.) Besides this nitpicking, I agree with the author for several years already. [1]: https://en.wikipedia.org/wiki/Date_format_by_country https://en.wikipedia.org/wiki/Date_format_by_country
- tom_mellior 6y ago> (And EU requires dd/mm/yyyy in "best before" dates.) This sounded intriguing, so I checked my fridge, and this doesn't seem to be strictly true. Everything I found used . rather than / as the separator, as is usual here (Austria). But also, some years were YY only. And the eggs are just plain weird: Both the carton and the stamp on the eggs list DD.MM. while the graphic explaining the date stamp uses a DD.MM.YYYY example date.