Live data from Hacker News

ISO 8601: a better date format

kirby.kevinson.org

11–20 of 437 posts

Re: ISO 8601: a better date format

#11
post #7

yyyy-mm-dd is so nice you can just work with strings for your date stuff, converting to objects and back is tedious Shameless plug: I built a python library to do exactly that https://pypi.org/project/yyyy-mm-dd/

Quite nifty and clean; I think this could play well with support for the duration (P-Y-M-D...) format in ISO 8601 that declares a positive offset. https://en.wikipedia.org/wiki/ISO_8601#Durations

Re: ISO 8601: a better date format

#12
As a european I use ISO 8601 for everything since about 5 years.

One point is also: if you manually write a date, the easiest to remember part (the year) comes first, then the month (which is usually also easily remembered) and then the thing that you can forget at times.

This feels better than the other way around.

Re: ISO 8601: a better date format

#13

The real advantage is that Azure and AWS and every other US-centric cloud service insists on showing me that something happened on the 3/11/2021. It's a wild guess to figure out if that is the 11th of March or the 3rd of November. Unless there's also another date with a number higher than 12 in it, there is no way to tell. None. None whatsoever. For US staff with US regional settings, it's always obvious which date i…

It took many decades to widely adopt UTF-8. I think that one of the reasons was that US companies did not really care about character encodings, as it's not something they have to often deal with. Even today managing multiple keyboard layouts is a pain in most operating systems, it's buggy, it does not have enough configuration options, it's not convenient. Probably because most US developers never tried to use that functionality.

Re: ISO 8601: a better date format

#15

The real advantage is that Azure and AWS and every other US-centric cloud service insists on showing me that something happened on the 3/11/2021. It's a wild guess to figure out if that is the 11th of March or the 3rd of November. Unless there's also another date with a number higher than 12 in it, there is no way to tell. None. None whatsoever. For US staff with US regional settings, it's always obvious which date i…

If it is in the browser it is probably just displaying using you local date time format

Re: ISO 8601: a better date format

#16
post #5
post #2

The real purpose of endianness which is missed here is the ability to sort. Sorting a list of iso8601 dates alphabetically means sorting them chronologically too.

Until we hit year 10000, but yeah, that's still a looong time to go.

There's some proposal that this year 2021 is actually 12021, to make the year neutral of some specific religious event.

Re: ISO 8601: a better date format

#17
The article is missing one of the best features of iso 8601: it‘s string form is naturally sortable. You don‘t need any specific logic for sorting, so e.g. your filesystem will automatically sort files correctly if you prefix them with a iso 8601 date.

Re: ISO 8601: a better date format

#18
post #8

Earlier quoted context omitted.

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 2021-02-26T06:22:59+00:00 2021-02-26T06:22:59Z 20210226T062259Z No…

I omitted this detail on purpose to not distract the reader who doesn't know much about date formats.

How 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?

Re: ISO 8601: a better date format

#19
post #8
post #2

The real purpose of endianness which is missed here is the ability to sort. Sorting a list of iso8601 dates alphabetically means sorting them chronologically too.

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 2021-02-26T06:22:59+00:00 2021-02-26T06:22:59Z 20210226T062259Z No…

I 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.

Re: ISO 8601: a better date format

#20
post #8
post #2

The real purpose of endianness which is missed here is the ability to sort. Sorting a list of iso8601 dates alphabetically means sorting them chronologically too.

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 2021-02-26T06:22:59+00:00 2021-02-26T06:22:59Z 20210226T062259Z No…

Spot 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

Post reply on HN