ISO 8601: a better date format
kirby.kevinson.org
kirby.kevinson.org
“The elements are always padded to the maximum number of digits. 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.”
I think it's across the hall from the room for people who configure servers for anything besides UTC.
It's not like it's a default parameter, you would have to explicitly pass zero if you want the "guess base based on prefix" behavior.
I also don't believe that when everything was adopted, that people realized how big a deal it would become for software, and systems driven by software.
Every leap second, factories shut down. Just in case. Every leap second we face the possibility of a large chunk of the Internet going dark like happened in 2012. Computer programmers spend millions of dollars per year in aggregate dealing with the possibility of leap seconds.
All for something that, over thousands of years, won't lead to as big a discrepancy between the Sun and the clock as what we voluntarily do 2x per year for daylight savings time.
Does it make any sense to continue this insanity? Why?
Millions of dollars in aggregate per year? Assuming that’s just the US, with ~4 million working programmers with a median pay of ~$86,000/yr or about $43/hr assuming about 2,000 working hours per year, that’s, if I’m not messing up the math, on the rough order of 1 minute per programmer per year, on the order of a couple hours per programmer per year if you bumped it to hundreds of millions. In either case, its a neglible share of programmer-hours.
Meanwhile leap seconds decrease accuracy when measuring long time periods unless you explicityly remove them again.
there used to be similar problem with alphabet (folder) sorting though, where Windows used to sort letter CH which goes after H in alphabet right within C as if CH didn't exist, but I think they sorted it in recent years, though I use English Windows and still have this issue, it's quite easy for sorting actually since H never follows C in Slovak or Czech language and when they are together they always make letter CH, so it should be easy to fix for sorting file/folder names
orally we use 12 hours time format even in most of the Europe, we just use in digital watch 24hr format
What I do when travelling in Europe[1] is to un-ambuigify the date by replacing the month number with the English month abbreviation: 2021-feb-26. It's non-standard but can't reasonably be misunderstood by a human.
[1] I'm from a European country where the ISO 8601 way of writing dates is common, and more specifically neither the American nor "European" formats are ever used.
Would be interested where anyone encountered issues with ISO8601 dates
"viachodinový" (multihour), "viachlavý" (multiheaded)... in Slovak. Not sure if there are examples in Czech.
Essentially, in Slovak it is impossible to implement algorithmical alphabetical sorting without understanding the language, to determine whether "ch" appears on the word stem boundary. But yeah, you can sort 99.99% of words by assuming it does not... and maybe increase it to 99.9999% by making an exception for words starting with "viac-".
UTC just happens to be a good natural choice for eliminating timezones, but I've seen companies chose another tz as their standard.
If you are developing software purely for internal use, that might be okay. But I think it is bad idea if you are developing software for customers, including cloud-based services. There is a good chance at some point you are going to expose your internal timezone to the customer somehow, even by accident. If a customer in another country gets told something like "process X always happens at midnight UTC, and we can't change it", they'll generally be more accepting of that than if you say "process X always happens at midnight at our headquarters timezone, and we can't change it". The second makes you sound like you maybe don't take globalisation completely seriously.
Even developing software purely for internal use, your headquarters timezone may change. Maybe the company gets acquired. Maybe it just decides to move to a lower cost or more business-friendly location (e.g. Oracle's recent relocation from California to Texas). A lot of stuff is going to stick with the old headquarters timezone because changing it is just too hard. But new stuff people may well choose the new headquarters timezone instead. Now you have two standard timezones to deal with!
That's why: just leave everything as UTC internally. Convert to/from user's preferred time zone at time of display and data entry. That works for almost everything, except for applications which need to schedule meetings, work rosters, class timetables, etc. For those kinds of applications, the application needs to actually save the timezone with the data, and support different records belong to different timezones.
It's also ironic how programmers are surprised by the passage of time when it's one of the only things that's truly guaranteed.
Things you take for granted are easy to overlook until they break.
You might just have a bunch of files from around the year that you just know won't ever be that close together in time, and which you perhaps also only ever touch manually, not programmatically.
I once chaired a smallish organization, and I used to name the minutes of meeting files with ISO 8601 style. If you have a dozen or so files from throughout the year, having them reliably sorted can make them easier to find, but there's never a problem with time zones or basically anything with granularity greater than a day.
Usually, if you've got a situation where you need to worry about time zones or DST, identifying things with year-month-day style timestamps treated as strings would be too low-tech a solution anyway.
(FWIW, the practice of using ISO 8601 didn't last, presumably because non-technical people didn't find them that nice for one reason or another.)
Sorting within a single year will work, sorting multiple years will place the same date adjacent to each other so it makes them easy to compare if you are printing out let's say sales data.
AM/PM thing is silly, but bearable.
Malformed MM[/-.]dd[/-.]yyyy date format is one of the most confusing thing I have ever encountered and it generates serious problems.
I would say that by just existing it create serious problems. You can never be sure if a date if day/month or month/day, this was especially bad from year 01 to 12. During those twelve years I was a date zealot "there can be only ISO 8601".
So do time zones. So do leap seconds. So does the speed of light. I guess deal with it.
None of what you argued negates the post you replied to. He is right after all. Dates within the year are sortable by pretty much any system.
But most of all the format makes ISO 8601 quite easy for Americans to wrap their head around. So maybe stop complaining and look at 8601 as a possible solution to what you consider confusing and problematic.
It's the default date format on my PCs, I've used it for decades. I find it hard to understand why eveyone doesn't use it.
Also, if you work for the UN, it's the default date format.
In their format settings, you have to pick a country and that determines the format of dates, time, numbers, and the unit system.
Of all the countries, none of them has the sane choice for all of the fields, namely: ISO 8601 for dates and times with 24h (no AM/PM), metric system (or SI, whatever), and dot as decimal separator.
You can have sane dates, but then you have AM/PM in the clock. You can have 24h clock, but then you have a comma as decimal separator, etc.
Can we add a country "Saneland" with the sensible options for all fields? cause that's where I want to be from. Saneland: the imaginary place where we use reasonable standards and things work.
en-dk is the best one, it is Europe standard english which I think fits all your requirements for Saneland.
An artificial en-xi or similar is probably best: take en-ie, and just change the short date format.
https://github.com/lattera/glibc/blob/master/localedata/loca...
It's inconsistent with da_DK, which uses DD-MM-YYYY.
But there's already the decimal separator bug (writing English? dot, writing Danish? comma).
% en_DK is used outside Denmark, as some sort of generic continental
% European English locale.
And that's the nasty hack -- this should be defined in en_EU or similar.I agree en_EU would make more sense, maybe somebody should submit a patch to glibc and in a decade it'll be safe to switch.
But there should definitely be a saneland locale. "en_SANE.UTF-8".
Sane Linux Locale settings
LANG="en_US.UTF-8"
LANGUAGE="en_US"
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_CA.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_DK.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
On my Debian system (KDE) that works for what you asked for. LC_MEASUREMENT="en_DK.UTF-8" sets SI units, LC_NUMERIC="en_US.UTF-8" sets dot as decimal separator, and LC_TIME="en_CA.UTF-8" sets ISO 8601 dates and times with 24H format. LC_ALL being left undefined is important, it will override the rest.The process for updating your locales will vary depending on your distro. But even if GNOME doesn't allow it you should be able to use the terminal.
While I'm typing this I realise that I've never actually read the ISO 8601 spec, like probably most people here, because it's not free. I cannot even be sure it really exists.
Indeed. The comprehensive Wikipedia article on ISO8601 is as far as we go
https://en.wikipedia.org/wiki/ISO_8601
Thanks for pointing out rfc3339 - this appears to be the "useful part" of ISO8601 for data interchange.
Also, neither RFC3339 nor Wikipedia discuss features like open-ended time intervals. They are in the draft, but did they make the final cut? And in what form? No idea...
The closest I've found to "official" documentation of the 2019 update is a short summary of the changes, hosted by Library of Congress[1]. Which is nice to have, but I sure wish the real standard was public.
I was very surprised to discover this. Why are they charging money for the specification of a date format? I would expect standards like these to be published in public domain.
ISO charges roughly 20 times the price of a paperback book for a 33 page document. You can buy BS/ISO 8601-1:2019 from the BSI for an even more exorbitant £246. Standards Australia will sell the older 2007 version to you for a mere AUD165.
But this is not special. All standards documents cost money from these organizations, from dates and times to electrical plugs. Treasure the fact that you can (for example) get (some) ECMA standards from ECMA for free. It isn't the norm.
Learn it, live it, love it!
For me, more significant reason to prefer RFC 3339 constrained profile is that ISO 8601 does not only mean YYYY-MM-DDTHH:MM:SS.sss but also includes bunch of alternate syntaxes like YYYY-DDD. And I have one big issue with RFC3339: there are cases when the "don't care about timezone" ISO 8601 syntax is actually useful.
Always wondered about this too. How can people implement a standard if they can't freely access and reference it? It's the 21st century. Why can't they just publish the document on the internet just like the IETF does?
They pay for it, out of the money they expect to make on the implementation.
It's a little problematic for free implementations, but then for most standards much less so than the engineering going into the implementation which has an (opportunity, if nothing else) cost.
https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_i...
https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0039_i...
Or https://www.iso.org/obp/ui/#iso:std:iso:8601:-1:ed-1:v1:en
The ISO8601 yyyy-mm-dd format is fine and intuitive. What trips people up all the time is the ISO8601 yyyy-www-d format (year-week-weekday)[1]. People who know it well can appreciate the benefits. But it's deeply unintuitive to people who encounter it for the first time, that the year in yyyy-www-d sometimes differes from the year in the yyyy-mm-dd format. And a perpetual source of bugs when inexperienced devs use the wrong year specifier (https://news.ycombinator.com/item?id=18762988).
The biggest wart in the spec IMO is the (optional) T in 2021-02-26T09:24, which makes the datetime format much harder to read for humans.
So many people are unaware that the ISO8601 format allows "week date" and/or don't understand its quirks, and articles like this one, which don't even mention that ISO8601 dates can appear in this format, compound the problem.
The "Week" format is great for planning purposes, because it allows a granularity between days and months with another whole number per year. Saying that a task will begin 2021-W08 and then defining the start of the week (ISO8601 says its a Monday), tells you exactly when it will start.
Saying the task is 2021-W08/P4D tells you exactly when it starts and how long it will take. Or P4D/2021-02-25 says the same thing but in terms of when it will end.
They're just as unambigious and just as useful.
https://www.loc.gov/standards/datetime/ seems to be a usable summary of the 2019 spec, though being just a summary means it probably excludes discussion of finer details and considerations which might be important at times.
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 is correct. That is the one single case where there is no confusion. This works as expected for just 4% of the world population, but it is those 4% of the world that get to decide the date format.
It's the most obnoxiously American attitude imaginable to ignore this issue because it doesn't affect them... only the other 96% of the planet.
/rant over
Just yesterday I learned that on an ISO Spanish keyboard, both of those browsers will pop up a help menu for ⌘⇧7. The logic goes: ⇧7 means / on a Spanish ISO keyboard, and ⇧/ means ? on a US-ANSI keyboard, therefore ⌘⇧7 is by the transitive property of inter-layout shift functions equivalent to ⌘?, which is the shortcut for opening the help menu.
They don't pop open the help menu if you press ⌘⇧', the actual ISO Spanish layout way to type ⌘?
Something like http://www.keyboard-layout-editor.com/#/gists/9150730dbd4d28...
Amusingly, TextMate's author and many early users were European programmers with US-ANSI keyboards (because the various European layouts are just too painful for writing code in ASCII-based programming languages).
Page down only sometimes works, and Command+~ to switch same app Windows works in some apps and not others. It's a bit of a train wreck when you want to get rid of their pointless keys.
Although macOS is good in the aspect that combinations akin to AltGr on PCs aren't unique to non-US layouts. I've seen programmers assume it's safe to assign shortcuts to Ctrl-Alt (which simulates AltGr), making it impossible to enter certain characters. Not surprising, as it's not used on the US layout (just as there's no extra key next to the left Shift).
The US conventions are indeed horrendous.
I am glad I have never met these people.
I disagree. (Or, perhaps I’m insane...) I paused when coming across the ANSI version in the article as I couldn’t tell whether it was YYYY-MM-DD or YYYY-DD-MM. I thought there was a typo or something.
I’ve nothing against the standard, but as Americans have no ‘intuitive’ reason to sort the fields by significance, it is natural for some to incorrectly assume the ANSI version is just the American version written backwards.
E.g. a single character to unambiguously denote weekday, window layout (全/広/高), and others. Renders everywhere as long as you have a decent CJK font. Bonus: looks a lot less stupid than emojis.
My desktop terminal prompt right now shows [金 19:58:22] - just a single character and as long as it's < 7d ago it's unambiguous what time and day a command exited in case I forget.
You're a bit cheating there :) It's one character that takes up 2 columns.
You could get away with using the first 2 characters from the English names as they are unique. But I know that in English that's unusual but for example in German, the 2 letter abbreviation are the standard ones.
You say weekday, but Google translate and Wikipedia say that 金 means gold?
"金" would be short for "金曜日", a common way to abbreviate weekday names in calendars etc and yes, Friday is indeed the day of gold - I like to imagine it's the old pay day for workers maybe? :D
The days of the week were named after the seven classical planets of astrology (by the Romans, who in turn named the seven classical planets, and hence the days, after Roman deities).
The names were taken up by speakers of Germanic languages, and eventually underwent semantic loan translation: Germanic deities were substituted for the Roman ones (with the exception of Saturday). Some people say that the Germanic deities themselves were culturally identified as one and the same as the Roman deities, but we probably won't ever know for sure (interpretatio germanica, analogously to the interpretatio graeca, the identification of Egyptian, Roman and Greek deities [1]).
And now, a minor correction: The day of Venus, Friday bears the name of the Germanic goddess Frigg, who is not the same as the Norse goddess Freyja. The meeting of the two characters, in a debate against Loki, is described in the Poetic Edda [2].
[1] https://en.wikipedia.org/wiki/Interpretatio_germanica [2] https://en.wikipedia.org/wiki/Lokasenna
It's so much fun trying to retrospectively correlate fatal incident data and failing to make sense of anything because some dates are inconsistent. Of course those dates are all the ambiguous kind, otherwise it wouldn't be -that- hilarious /s.
As an American I can fully confirm that 3/11/2011 is obnoxiously ambiguous. It affects us. But most Americans (particularly outside of science / engineering fields) are too thick-headed to recognize the problem or think about ways to improve it.
So I do what I can. I don't even ask what time format something belongs in. I just write ISO8601 by default. If someone complains then I point them to the international standard and ask whether we want to be an internationally standards-compliant company.
One manager said that our customers aren't international. It was a reasoned argument and I like having customers. But all others drop the argument at "international company" and "standards-compliant"
And also ask but why are we not targeting international customers.
The latter was an ice rink whose customers are very physically local. Local teams do compete internationally but the ice rink itself isn't an international org.
This is my approach as well. I've never gotten a complaint about it, which proves to me that the format is understandable AND unambiguous.
TZ=UTC+8. Is your system now set to the timezone UTC+8? No, it's set to UTC-8. Why? I don't know, but I suspect the people who developed this convention, who lived in the US, just didn't want to type a minus.
Use https://en.wikipedia.org/wiki/Tz_database names instead.
I’m not going to comment on the author, though I will acknowledge the abrasive, unhealthy attitude.
Anyway, no. I don’t think there’s a clear “American” standard. Maybe there once was, but I’d just see a pile of numbers these days. It’s hostile to the consumer as it inherently leaves some uncertainty of how it should be consumed.
I will say, and maybe this is American - but I don’t think it is - that I often see dates formatted unambiguously as, e.g. March 11, 2021.
To us, US English seems to skip a lot of the small joining words of various flavours.
America first!
sigh.
ISO 8601 everything. I'm religious about it. I write it in messages, on government forms, anything that doesn't force me to use a different format. On a bit of my insistence, we use ISO 8601 notation for all dates at home. I think the benefit is quite obvious once one starts using it.
That doesn't seem like a standard API call.
https://developer.mozilla.org/docs/Web/JavaScript/Reference/...
Your code has a bug, missing constructor.
What developers also suck at, in practice, is data-typing their output properly. If I see 5/2/11 on a US site while using my work laptop, I can't be sure whether it's the US notation written by the author, or date localized by my browser for UK format, which has the day and month reversed. I can't tell if the date is localized or not, or how it was generated.
Just say no to all that complexity, and use ISO 8601 everywhere. My controversial view here is: in this industry, we're still in a privileged position to force the entire world to standardize on the important things, like dates and times. So let's do so, and get everyone on board with an international standard, instead of just unwittingly pushing the USA defaults. We are pushing things, that comes with "software eating the world". So let's push things that make sense.
Also, should you want to change the locale (via a preference or override somehow), in most browsers you can pass it as the first parameter.
I think your view is very much a classic developers view - sure it would be nice to be able to dictate software requirements to businesses but you are probably going to be quite angry as your version of right and someone else's are going to be different.
There are absolutely no usecases where the US date format makes sense. No, having it written in the order you prefer to pronounce it is not an argument. Especially not in the language where you have to learn spelling. It is just what US people are used to.
The thing is, we sort of are! As I mentioned upthread, notation and language are being strongly influenced by increased use of software in every facet of our lives. The way people note numbers, dates, express search terms, etc. are all impacted by what the software accepts and displays by default. We have an opportunity here to push for positive cultural change around international standardization, so let's make good use of it, instead of squandering it by just implementing whatever seems to resemble the local status quo the most.
3/11/2021
3/11/2021
The difference is one was formatted incorrectly, and the other was formatted correctly. One is 2021-03-11, the other is 2021-11-03.Even having been told that there's a difference, you cannot know which is which.
Even if you think you know because you found an unambigious date like 31/11/2021 somewhere, you still shouldn't be confident because there are many sources of dates, and they're formatted by many different pieces of code. Some may be doing the "right" thing, some may be using US formatting. A complex web application like the Azure or AWS consoles might have literally thousands of sources of dates formatted by a thousand different pieces of code.
Before the 12th of the month, they're all totally and utterly useless for 96% of the world unless they use ISO 8601.
BTW: I just tested this with the Azure portal by clicking through some Log Analytics related things. I got it to show me 3 different date formats, 2 of which would have been ambiguous earlier in the month, and one of which changed between two tenants. So even if you learn which parts of the UI you can trust to be correct, switching tenants will invalidate your experience.
users who don't know what ISO 8601 is would learn, simply because when that format is used in software, it is consistent!
Wikipedia claims [0] that is the date format in Kazakhstan, but only for the Kazakh language, not for Russian. (Maybe there is someone here from Kazakhstan who can confirm if that is true or not.)
A lot of companies don't have any employees in Kazakhstan (which means they can ignore this for internal systems); and many companies wouldn't have any customers there either (which means they can ignore it for external systems as well).
I’ve scheduled cron jobs for February 31st, to have them tracked but disabled.
Perhaps use a format like 3/Nov/2021?
(And in general case, of electronic documents with wider audience, using 3/Nov/2021 excludes people who don't know English (or the language in which you encoded the name of the month).)
(Real use case: I recently sent a Polish equivalent of OSHA form to my line manager in UK, and I used a bilingual version. As you can imagine, I set the example by filling my part of the document using ISO 8601 for dates, so that once the document returns to the Polish corporate office, there won't be any possible confusions.)
People were unfamiliar with showering and brushing their teeth. We move forward.
Maybe it's just Croatian that's ruining it for everyone.
Around this part of the world, almost everyone calls tea by some variation of the word "chai". But not us. In Polish, it's herbata!
On government forms (and other paper forms), I use 3/11/2021. It's unambiguous; nobody would expect it to mean anything other than "3rd of November of 2021". The ambiguity only happens once you add the Internet to the mix, and even then, only in English-language websites (I wouldn't expect anything other than DD/MM/YYYY on Portuguese-language websites, and the same probably applies to most other languages).
In a globalized economy, local date formats are just one of those annoyances that serve no benefit, cause everyone unnecessary hassle, occasionally causes expensive errors, and that should have long ago been replaced with an international standard.
If the answer comes back very US, then it's middle endian US format. Else it's DMY.
Note that the article is wrong to just say "dd.mm.yy" is used in "Europe". Some countries use yyyy-mm-dd and others dd/mm/yy.
The US format is the only one that's retarded, though.
I wonder how it started? A skim of the internets hasn’t enlightened me.
But people are very good at verbally saying different than is written.
But also, the most sacret of all days has been honored by the one day of the year "said properly" fourth of july!
Tax day is the ides of April, but we just say April 15th.
I was once sent paperwork to fill out that had dates requested in both MM/DD/YYYY and DD/MM/YYYY formats on different pages.
My american users get very angry when they see a date that isn't in dd/mm/yy format.
English has a word for twenty and its used in the French way "Four score and seven years" is "quatre-vingts et sept".
- to an outsider, learning that a concept exists: “that is an interesting thing”
- to a beginner, trying to construct the right form or to detect it in quickly spoken speech: “this is annoying and I hate it”
- to an intermediate speaker and beyond: “eh it’s maybe weird but whatever”
I used to hate noun declension in Czech as a beginner (7 cases x plural/singular = 14 forms a noun can take[0]) because it’s intimidating and unintuitive for an English speaker, but now I’m at the “meh” stage.
[0] - then consider that there are 3 genders, and each gender has a handful of “models” (patterns for declining words that look a certain way), and also a bunch of exceptions. Not the hardest thing in the world, for sure. But it’s definitely a bit of a pain
You may not be able to correct it from the Information available but you’ll know something went wrong.
Nope, just French.
56 - seksoghalvtreds(indstyve) - six and [two score plus] half [of the] third (score) The reference time used in the layouts is the specific time:
Mon Jan 2 15:04:05 MST 2006
which is Unix time 1136239445. Since MST is GMT-0700, the reference time can be thought of as
01/02 03:04:05PM '06 -0700`
Golang was not meant to become a big international language from the start? Just a fun internal Google project ;-)It is one of my favourites (the "8601", the "Security", and the "Bobby Tables")
Ahem, ISO8601 fails for Taiwan and Japan...
I use ISO8601 dates everywhere possible. Paper forms in the real world where people look at me strangely, invoices, file names which is really handy for sorting, my personal todo lists, everything.
E.g.: 2021-05-01T12:00:00Z/P2H
They are so convenient. Ever stored a tuple of two datetimes to model a time interval? E.g. a meeting that takes place on 2021-05-01T12:00:00Z and takes two hours?
Don't! Instead, store it as an interval: "2021-05-01T12:00:00Z/P2H"
Or are you creating an API where a duration or a time interval is expected? E.g. "give me all sales in this time period..."
Using time intervals for that makes it so much more easy for people to code against it and execute manual queries.
For JVM developers, there is a library out there that has amazing support: https://github.com/MenoData/Time4J
For python developers, there is pendulum which supports most of the functionality.
Was just in a software design meeting where they were trying to figure out how to represent exactly this: a time interval.
I had to repeat "Just read ISO 8601 and use it" like a dozen times.
"Bu-bu-but what if we want to represent a recurring..."
READ IT. AND USE IT.
Given that china is the country with the largest population it may not be a bad idea to use something a large number of people will easily understand.
Edit: this is not sarcasm. It’s simple logic, unless there is something wrong with learning other languages.
Anyways, here's yours: Slippery Slope.
FYI: English has ~1100 million total speakers but only 318 millon native speakers, while Chinese has 918 million native speakers. https://www.visualcapitalist.com/100-most-spoken-languages/
Unless it's already out of date...
You've made the assumption that all Chinese people speak one language, which is a false assumption I'm afraid [1].
No I didn’t. I cited the fact that Chinese is the largest natively spoken language in the world, by an order of magnitude.
Why would that matter? Arguably the ideal lingua franca should have no native speakers at all as those have an unfair advantage.
I share your vision of an explicitly taught universal language which gives no group or individual an unfair advantage. We obviously need more equality in the world.
From the perspective of trying to maximize how many people with whom you are able to communicate, however, on a practical basis it matters little whether or not they are native speakers.
This is terrific, thank you. So meta.
Other popular examples:
"Is this some kind or radical new therapy?" from What About Bob? https://youtu.be/0pKymngWgJw?t=50
McNaulty from The Wire https://www.youtube.com/watch?v=sIvsTXnik7Q
even China commentators in Western media are often completely clueless about the language. If these jobs don't require Chinese fluency, then which ones do? And even then, it'd be much easier to employ the many, many native speakers who emigrate from the PRC.
That doesn't stop those commentators from getting lucrative jobs. Apparently, western audiences don't care to verify whether what commentators say are accurate, or audiences just don't care whether it's accurate. There are no consequences to even years of inaccurate commenting. So I guess if you have no professional pride, then yes you can get away with not learning Chinese.
That's why I'm planning on having my daughter learn Mandarin along with English - to prepare her for the shape of the economy she'll be living in.
I suppose that means we could also do the following if we really wanted a western version:
2021⊕317
Edit: Turns out that hackernews isn't quite astrological unicode compliant yet but imagine the astrological symbols for sun and moon in there as well.
(I’m not even Christian but I also don’t have a chip on my shoulder and can accept its influence on the world)
So now we have: another calendar, that has a starting year that is defined by subtracting an arbitrary number from a compromise between alledged years some person was born in.
I love how humanity has the capability to invent new things with increasing complexity.
[0] https://en.wikipedia.org/wiki/Anno_Domini#Birth_date_of_Jesu...
> 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
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_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.
> "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?
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.
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.
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.
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.
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.
US dates only make sense if you don't care about the year and are writing on the left most side of a page; that might make sense if ink or paper is at a premium.
The blog post already made this observation, saying that YMD is the only format where the endianness of the date components match the endianness of the numbers; DMY does not have this property. If you wanted to sort dates correctly on the right hand side, you need to write the numbers backwards too, like "72/20/1202".
I wish it was the norm.
Sometimes I tell onlookers that it's an ISO standard.
Take for example the timestamp "2025-07-20 13:30:00+09:00":
- If it was supposed to represent a meeting in Asia/Tokyo and that region changes offsets (DST or political reasons), we don't have enough information to update the timestamp because it could also have been Asia/Seoul or other.
- If a leap second is subtracted at 2025-07-20 13:30:01+09:00, we'll see that timestamp twice and it's now ambiguous which moment it refers to.
- If a leap second is added at 2025-07-20 13:29:59.9+09:00, we'll never see that timestamp and now it's not a valid moment anymore.
- Because of the regional offset changes and leap seconds between now and then, I can't reliably subtract that date from any other date to calculate durations.
I'm struggling to think of a situation where this timestamp format is the correct one.
Why don't we have "2025-07-20 13:30:00+09:00[Asia/Tokyo]" or even just "2025-07-20 13:30:00 [Asia/Tokyo]"?
[0]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
So while having 2021-02-26 18:38:00 Asia/Tokyo as a timestamp would more accurately represent the time, it would create another set of issues, namely requiring a database to look it up, and requiring to keep those database in sync in all systems in the world. Having both may be redundant because in that case you can't still trust the offset.
There are alternative systems such as TAI64[1] based on TAI[2] that are meant to accurately represent the moment in time without being subjected to leap second (only account them on conversion to UTC). The main issue is TAI64 is not really human readable (e.g. @4000000037c219bf2ef02e94) and would still require database of leap seconds to accurately convert back to UTC.
[1]: http://cr.yp.to/libtai/tai64.html
[2]: https://en.m.wikipedia.org/wiki/International_Atomic_Time
About the TZ database, don't all date lookups require accessing it? If I schedule a meeting in Asia/Tokyo now, and the database tells me it's +09:00, I still have to remember it's Asia/Tokyo because the offset may change 5 minutes before the meeting.
Analyzing the timestamp requires a TZ database, but that's calendars for you; the encoding is not going to change this. We don't actually know when the meeting will take place until it does.
I'm still struggling to come up with a situation where including only the offset is the correct approach, which makes ISO 8601's decision puzzling.
If the database changes, I have to go back and edit my timestamps (!), but I dont know which ones to edit because I didn't keep track of (1) which ones are +09:00 because of Tokyo, as opposed to Seoul, and (2) which ones were created with the old database.
In this case, timezone is external to this format and the timestamp can be calculate back to UTC without relying on zoneinfo (which is very useful for exchange). Any further conversation would be external to this format. e.g., in case of calendar, it's probably more useful to have datetime in local timezone rather than of the other party's timezone so the tuple would be (utc_time, local_tz) rather than (other_localtime, other_tz, local_tz).
> - If it was supposed to represent a meeting in Asia/Tokyo and that region changes offsets (DST or political reasons), we don't have enough information to update the timestamp because it could also have been Asia/Seoul or other.
I don't store timestamps in ISO; I use them for communication, then parse and store them as epoch time. So if the regional offset changes, the epoch time doesn't. In theory, that epoch time is absolute and I can display it localized to anybody's preferred locale later.
In that light, adding/substracting seconds is just adding/subtracting seconds, although I'm usually passing that work off to a date library, which I hope accounts for skipped seconds caused by leap seconds....
For DST shifts and leap second things, aren't certain time strings just as ambiguous with a location-based time zone as they are with an offset?
Good point. I'd argue that location-based time zones make the uncertainty more explicit, but they don't remove the ambiguity.
> epoch time is absolute
That's a consistent approach, but is it correct?
Let's say I'm today in America/New_York and I schedule a local meeting for March 15th at 13:00 (the day after Daylight Savings Time is scheduled to start). The string 2021-03-15T13:00-04:00, or its equivalent epoch time, is saved in your system.
The government then decides to postpone DST by a couple of days.
Your saved epoch time is now equivalent to March 15th at 14:00 in America/New_York. If you display it back to me like that, I'll complain your system corrupted my input.
This can even happen to timestamps in the (recent) past, since abrupt changes can take days to propagate to user's TZ databases and lead to retroactive changes.
If my meeting was stored in your system as "2021-03-15 13:00 [America/New_York]" instead, there would be no problem. The same approach works with the virtual "local" timezone, used for alarm clocks, birthdays, new year celebrations, etc, which cannot be converted to epoch time.
I don't know if this is the best solution, as I've never deployed it at scale. But it sure sounds more logical to me.
Another way to think about it is like this: Suppose right now you schedule a future event that happens at exactly 2025-07-20 13:30:00 in Tokyo time. Then you calculate exactly how many seconds in the future that event is (based on Tokyo's current time zone rules, assuming no political changes), and you start an offline countdown timer that has no Internet connection and no knowledge of time zones. You can think of ISO 8601 as basically this - a way to describe absolute points in global time without references to politically motivated definitions of local time zones.
As for the second issue regarding positive/negative leap seconds, this issue is not unique to ISO 8601. It stems from UTC, and afflicts every popular system for describing time-of-day. If you want to subtract dates reliably to calculate the physical (rather than calendrical) number of seconds, you want to use TAI (Temps Atomique Internationale).
But that's TAI. Any calendar is a consensus agreement and amenable to politics (see Samoa skipping a day in 2011 [0], and all the bizarre calendar changes of the 18th century).
ISO 8601 sounds simple and reliable, but only because it refused to adopt most of the human complexity of timezones. Kinda like "extended ASCII", that allowed programmers to pretend just a little longer that all characters can fit in 8-bits. And we don't have a Unicode for dates.
If Tokyo changes their DST rules or leap seconds happen, your simple and reliable offline countdown timer will be wrong. How is that acceptable for a calendar-based (i.e. human) format?
Or if I'm naming my files with ISO 8601 dates and relying on lexicographic sorting (as others in this thread suggested), I'll have gaps or overlaps after DST changes.
Am I crazy? I'm getting lots of disagreement, so I must be doing something wrong, but the more I think about it, the more I believe that ISO 8601 succeeded by stealthily sacrificing correctness.
But it isn't. It's unnecessary complexity because additional numeric zones offer no real information beyond what UTC-only provides when you want to “describe absolute points in global time without references to politically motivated definitions of local time zones.”
That's simply not true. The American format is designed to reflect how we normally pronounce dates or write them out in long form (eg "September 11th, 2001").
The European format is also flawed. It's similarly divided into three tokens (day, month, year) but they are ordered so that the tokens represent greater magnitudes of time moving from left to right, big-endian-style. The problem is each token is a decimal number which is traditionally written in little-endian-style. So like the American format, you still need special understanding of the format to read dates and they cannot be trivially sorted.
The ISO 8601 format is little-endian all the way through so it is trivially sorted. UNIX time is even easier to sort and compresses much better, but it's rather difficult for humans to read.
In the UK at least, we don't write or say dates in that order. With the exception of September 11th.
I believe it's the same in German, 4te Juni etc.
Not everything logical works with humans. In my day to day life (not engineering use), I personally prefer inches and feet, they are just human scale dimensions. Conversion happens less often than you think - most people convey to others that this box is 12x8x8 inches. Conversion from inches to feet happens way less often. I hate fractions though. It would be great if a centimeter was twice as long in physical dimensions. It's just too granular and falls in an uncanny valley. And no one uses decimeter (10 cm) for some reason which is actually nice since it is roughly the size of the index finger.
For most of the literature people read in the 21st century, especially this past decade, the year is the most important part. People normally couldn't care less whether something was published 3 days ago or 3 months ago. But knowing whether it was published 3 years ago makes all the difference in the world to its relevancy.
There are many use cases for dates. From publication date to planning vacation on a calendar. What is the most common use for a date? Calendar, I guess? The most frequently used dates we encounter are within +/- weeks from now. In a day to day use, YYYY is useless.
Another common remaining example might be a bank statement. But what's interesting there is that the dates are in a column and the year disappears. It hardly matters whether the year comes first or last because you don't actually notice it at all unless the year is rolling over--conspicuous change in that column.
But when I'm looking at something lacking implicit context regarding publication date, such as an online magazine article, a YouTube video, or a Tweet, the year is the first thing I'm searching for. Even on HN, the rule is that the year needs to be included in the title if it wasn't published in the current year.
I guess for e-mail the day and month are most important (similar to bank statements), unless you're reading really old messages. But I use mutt with a default mailbox view that doesn't even show the year.
Speaking from personal experience, even an American can make an effort to use YYYY-MM-DD in any situation asking for a numeric date, and almost always succeed. The biggest exceptions are forms asking for MM/DD, and online payment forms asking for credit card expiration as MM/YY.
1 Feb 2021
This is a bit more human-readable and closer to commonly-used forms of dates while still being completely unambiguous.A bit more human readable you say? So 1 фев 2021, 1 Lut 2021, or 2021 فبراير1 are readable to you? I don't know but to me that's just US-centric thinking all over again.
I was going to ragequit at you for copy+pasting something into google translate, as it's شُبَاط not فبراير.
but TIL, only in the Levant do we say شُبَاط apparently.
Someone was getting the date as 01MMMYYYY and using it as a partition name. When the first day of the tenth month happened, everything broke, because it was expecting OCT, not OKT.
Unambiguous but wrong.
With humans reading it, either you need to be unambiguous, so use yyyy-mm-dd, or you don't have to be, so use a format that most of your audience will understand.
Nobody forces you to write ISO 8601 dates but if you want your dates to be easily parseable by humans, why would you write them all in numbers?
3 Nov 2020, 3rd November 2020, Nov 3rd 2020, even something like 2020 Nov 3 is uniquely parseable by humans. Even if the human doesn't know the language of the month, they can still find out what date it is from a Google search.
With 3/10/2020 you never know for sure what date it is.
> I personally prefer inches and feet, they are just human scale dimensions.
Meter, centimeters, and millimeters are human scale dimensions, too. Just because you didn't grow up with them doesn't make them non-human.
But that's the beauty about easily convertable units. Even if other people use other conventions, the mental process to convert them is almost zero.
Just imagine somebody giving their height just in inches instead of the usual feet and inches?
Could you mentally parse what 76 inches are?
I guess you have basically no problem with 193cm, 1.93m , or "one ninety-three", or even 19.3dm.
Now only if we evolved to have 12 fingers, we would have a supercharged metric system in duodecimal (base 12). Far superior to the decimal number system we use today.
US people measure their weight in pounds, 182lb
So yes, a USian telling their weight to a UKian would be like saying their height in inches.
We also tend to still refer to height informally in feet and inches.
That's about our only remaining usage of imperial units apart from inches in penis size. We refer to a serving of beer between 425mL to 468mL as a pint, but it's only a descriptive term and not a legal measure.
Really? It's hard to parse the year??
What about when you come across a piece of paper written some time ago, is it not useful to know the year?
> most people convey to others that this box is 12x8x8 inches
"Most people" == nobody outside of the US.
> And no one uses decimeter (10 cm) for some reason which is actually nice since its the size of the index finger
I just measured my index finger. It is 8.45 cm.
Replace inches with cm, I didn't explain it well. Even if it is centimeter, people would tell dimensions to others more than convert them. The point was about frequency of communication between humans vs. frequency of converting units.
You seem to be taking offense that I said something US-centric. I didn't mean that at all.
Is it so hard to write "it is?" Nevertheless, you used a contraction.
You did so entirely unconsciously because that's how langauge works.
But if the software show 2021-03-02, I unambiguously know which it is.
We weren't so globally connected just 20 years ago, so if you were in US, you were used to MM/DD format and if you were anywhere else, you were used to DD/MM format. It was all local.
Within a certain range you'll do fine either way. Outside of a certain range you'll always need a measuring tape, or you just had a had a lot of practice, eyeballing and learned habits going in.
The Hungarians (and presumably the Chinese) have their own just-so stories about why YMD is the most practical order: you use dates mostly when you sort heating bills, invoices, or even fruit preserves, and in all those cases you need to sort by year first.
Australians will tell you a tale about how "day before month" is human-scale, while "month before day" is not. Heck, ask a German why the decimal comma is superior to the decimal point, and you'll hear plenty of practical-sounding reasons. French carpenters will tell you how they use decimal units because those are much more practical than inches. British people will explain how left-hand traffic is the only practical choice (6a41ef).
People are much better at confabulating reasons for sticking with conventions than they are at telling practical and impractical conventions apart. Indeed, if there was one obviously practical choice, there would be no differing conventions for ISO standards to reconcile.
I should note that the Hungarians (can't speak for the Chinese) obviously leave out the year when it's clear which year is meant.
Take for example "October the third, two thousand nine" (10/3/2009, MDY). In German one would pronounce this as "der dritte Oktober zweitausendneun" (3.10.2009, DMY). In Hungarian "kétezer-kilenc október harmadika" (2009. 10. 03., YMD). All of these pronunciations reflect the order numerical dates are written: using any other convention would simply make them less natural to pronounce.
Now it is certainly not unheard of that the order of pronunciation also changes (see the British "the third of October"), but changing language is a lot harder in some cases impossible without breaking grammar than changing written numerical representations.
Sure, date order may be decided based on accidental grammatical features of the target language. But that just reaffirms that "practicality for the common man" is rationalization.
Naturally, the written convention need not affect pronunciation: in the case of numbers, the world standardized on decimals with place values increasing from right to left, but most languages retain their own idiosyncratic ways of naming/reading them This causes negligible friction in practice.
Why big endianness is great though, in practice is that most of the time you actually do care about the year when you use the written form AND it's unambigous. The problem with the reverse notations is not that it seems illogical to some people. The problem is that both d/m/y and m/d/y is used and you can't have the faintest idea which one you are looking at.
Now in theory we could have y/d/m, but we fortunately don't, so seeing the first number being a 4 digit one, you know how to interpret the date.
And 3/2. Is that the future or the past? No way to know. Did you miss the meeting, or is it next week?
"No one uses a decimeter"... What bubble do you live in? But please, lecture some more about cultures you don't understand.
Works fine for the Chinese and Japanese, and last I checked they were humans.
American English already has this weirdness elsewhere - the $-sign in $15 is read in the "wrong" place and always trips me up when I'm reading something out loud but others will defend that practice to the death
But it's not always unambiguous. ISO-8601 supports local time. It's only an unambiguous timestamp of the time zone is included.
Made me chuckle, but I agree.
There are many different European formats, some countries even use (a slightly modified version of) ISO-8601, ex. in the Nordics.
['en-US','en-IE','en-GB','en-ZA','de-DE','es-ES','nl-NL','pl-PL','ru-RU','cs-CZ','sv-SE','fi-FI','lv-LV']
.forEach(lang => console.log(lang + ': ' + new Date('2020-02-04').toLocaleDateString(lang, {day:'numeric', month:'numeric', year:'numeric'})))
en-US: 2/4/2020
en-IE: 4/2/2020
en-GB: 04/02/2020
en-ZA: 2020/02/04
de-DE: 4.2.2020
es-ES: 4/2/2020
nl-NL: 4-2-2020
pl-PL: 4.02.2020
ru-RU: 04.02.2020
cs-CZ: 4. 2. 2020
sv-SE: 2020-02-04
fi-FI: 4.2.2020
lv-LV: 2020.02.4.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.
Other than inertia/tradition there is really no excuse for shuffling around a date in any other way.
So I would generally advise against accepting iso formatted dates and instead decree a single date format.
270009LFEB21
Translation: The 27th, 00:09, "L" timezone (+11, NATO timezone[2]), February, 2021.Advantages:
- it's much more compact than ISO8601.
- the most significant information is first; the date.
- the second-most significant information is second; the time.
- the timezone is a single alphanumeric character.
- when military paperwork has a box at the top that says "DTG", everyone knows the format.
- I'm pretty sure it's a standard across all NATO militaries.
[1] https://en.wikipedia.org/wiki/Date-time_group#Military_Date_...
[2] https://en.wikipedia.org/wiki/List_of_military_time_zones
ISO 8601: [YYYY][MM][DD][hh][mm][tz] (0 1 2 3 4 TZ)
Military DTG: [DD][hh][mm][tz][MM][YY] (2 3 4 TZ 1 0)
"I’m here to (hopefully) change your mind by introducing you to a lesser-known date format called ISO 8601."
It seems so foreign to me, and most people i know, to use anything but ISO8601 or RFC3339. Might be, as with most things, that we here up in the Nordics simply are used to it.
The author confuses value to the reader with magnitute. In normal numbers, they happen to be the same thing.
In most cases, we want to discern between days first, them months, then years. If you look at a list of dates:
2021-01-01
2021-01-02
2021-01-03
2021-01-04
You're just going to be seeing a heap of noise before you see the actual number you care about.
If you consider that days are the most valuable, then months, then years, you get the UK/European format.
01/01/2021
02/01/2021
03/01/2021
04/01/2021
That really, really depends on particulars on your life. While I strongly dislike the US format of putting the month first, the irony is, the month is the most important datum for most of the dates I read with. Year is usually obvious given particular context (it's typically either the current one, the next one, or sometimes the previous one). Days don't matter for anything that isn't in the same month. I'd go as far as saying that months are typically the most important for most people in XXI century, then days, then years.
But that's no problem for punctuated date formats in general. People don't read things linearly at letter level, they deconstruct tokens in a random-access way. Separators like - or / help clearly identify which part is which (compare how easy it is to read 03/01/2021 with 03012021), and there's no extra cost associated with reading off the part in the middle.
The benefits of YYYY-MM-DD notation on top of the above are:
- With all terms being fully expanded, dates line up vertically as well, which helps when dealing with stacks of documents or tabular data.
- Being ordered by magnitude like normal numbers provides a Schelling point for interpretation[0]. That is, when a random person who wasn't exposed to much computing or internationalization before sees 2021-01-03, they will automatically assume that 01 must be the month, because writing YYYY-DD-MM would be dumb and inconsistent with how numbers are written in general.
Yes, both of these apply to DD/MM/YYYY, but, YYYY-MM-DD also gets you sane lexicographic sorting, which the UK/European format doesn't. It's super useful feature not just when dealing with computers, but also when perusing any kind of date index. ISO 8601 dates work much like words in a dictionary, you can binary-search through them.
--
[0] - https://en.wikipedia.org/wiki/Focal_point_(game_theory)
> 2021-01-01
> 2021-01-02
> 2021-01-03
> 2021-01-04
With you so far.
> You're just going to be seeing a heap of noise before you see the actual number you care about.
100% disagree. There's less noise here than having days from other months or years mixed in. If there's noise here then either I am on the wrong page and need to navigate to the correct year or else the data I want has few data points.
> If you consider that days are the most valuable, then months, then years, you get the UK/European format.
> 01/01/2021
> 02/01/2021
> 03/01/2021
> 04/01/2021
Maybe. Your list is contrived. Here's another.
01/01/2021
01/03/2021
01/04/2020
01/10/2021
01/11/2019
02/01/2021
02/13/2019
02/20/2021
Those numbered days are completely irrelevant to each other in most circumstances. Now other months and even other years are mixed in. Expand this list to 1000 data points and good luck figuring out where your data's at.
Generally speaking, a lot of these issues are knowing when it's appropriate to use what format. When displaying a date to a user, you do it in their configured local time, and in their configured date/time format. I don't think the author is advocating changing that behavior[1].
Where the problem comes in is "how you store date/time values". Normally, I don't find myself arguing as to the format. Generally speaking, people default to ISO-8601 for log file naming (many probably not realizing that's what they're doing -- aiming only for a naturally sortable list). The places I tend to store dates (databases) define how they're stored, otherwise. That doesn't mean a developer isn't going to store the date in server local/user local time (and often make discovering the reference time zone impossible). Please don't do this. Store in UTC.
I'm not sure why the author is so hung up about the ordering of the dates, but while I worked in telecom, I briefly had a boss that was really particular about that (I've worked for a few folks in the UK, only this first boss had hang-ups). The US ordering probably originates from the most common way dates are spoken in the US: "Januaray 17th". A year is less frequently necessary, but when it is, it's tacked on the end. I don't think anyone thinks the way we write dates is particular superior, it's just the way we've done it since we first learned about dates.
One thing I learned when I started working regularly with non-US folks. Never use numerical dates. Even if you write it in the format they are comfortable with, if there's any ambiguity, they're likely to assume you wrote it in the US format. I started writing/abbreviating month names. I ended up altering the written order, as well "17th of January or 17 Jan" because that particular first boss jokingly-non-joked about how obnoxious the other way was.
Everybody's got their tabs/spaces war, I guess!
[0] OK, so it's more of a pet peeve.
[1] While it would be nice if we all used the same date/time format in our day-to-day life, it's one of those things that I'll wager will never happen... and I'd argue that doing so would cause more problems than it would help.
> Maybe the European date format is better because the elements are in the order of relevance? > ... when we’re talking about events occuring on a day-to-day basis, however I can think of numerous cases when the year and the month are more relevant
I think that's the "sense" of the American one. It optimizes "metal sort" for month.
The simple reason is that I have been bitten by time zone shenanigans way too often.
The same stands for databases always use timestamptz and not just timestamp.
Every frontend framework has functionality to properly and reliably format dates for a given locale.
As for filenames. It contains a space which is a pita for command line use.
From wikipedia: "If a time zone designator is required, it follows the combined date and time. For example, "2007-04-05T14:30Z" or "2007-04-05T12:30−02:00"."
The biggest problem I see is the time notation part using colons. Windows still doesn't allow using them in filenames in most places.
- Only offset-based time zones are allowed (which are next to useless).
- Omitting the time zone defaults to local time, which renders the time ambiguous. Defaulting to UTC makes much more sense.
- BC dates are all offset by 1 ("-1" = 2 BC). I know the reasons for this, but this could have been moved to the implementation and not exposed to the user.
- Lots of silly things like fractional-minutes and multiple ways to represent the same data bloat the spec and implementations.
This is why I rejected iso-8601 and developed my own for https://github.com/kstenerud/concise-encoding/blob/master/ct...
Examples:
2019-8-5 : August 5, 2019
-300-12-21 : December 21, 300 BC (proleptic Gregorian)
12:05:50.102 : 12:05:50 and 102 milliseconds UTC
4:00:00/Asia/Tokyo : 4:00:00 Tokyo time
2019-01-23/14:08:51.941245 : January 23, 2019, at 14:08:51 and 941245 microseconds, UTC
1985-10-26/01:20:01.105/America/Los_Angeles : October 26, 1985, at 1:20:01 and 105 milliseconds, Los Angeles time
25192-11-01/03:00:00/48.86/2.36 : November 1st, 25192, at 3:00:00, at whatever is in the place of Paris at that time (global coordinates 48.86, 2.36)
Shameless plug: I built a python library to do exactly that https://pypi.org/project/yyyy-mm-dd/
As close to canonical as you can get.
So you could specify a negative offset as a duration and the end time.
P2H/2021-02-26T13:30Z is two hours prior or T11:30Z on the same date.
I notice that your library is targeted at notebooks, though. It seems useful in that context, but not for general programming.
Of course even then, yyyy-mm-dd is best.
ls -l --time-style=full-iso
git log --date=iso
date --iso-8601=s # or date --rfc-3339=s
export TIME_STYLE='long-iso'is he being ironic? One of the things I love most about 8601 is it being supported by basically every* std lib (and definitely every library working with dates)
* JS, Python, Ruby, PostgreSQL,...
And never looked back. Because since then I have no problems with dates anymore.
If there is a need for 'ms' you can add them in the end or add more sections for more precision.
For me it solves it.
If I meet another date format I convert it to this one when possible.
For instance I setup this date format for MacOS in Settings->Language & Region->Advanced->Dates: this way:
Short: y-MM-dd
Medium: y-MM-dd
Long: y-MM-dd_HH-mm-ss
Full: EEEE,y-MM-dd_HH-mm-ss
You just put those strings there and it should work.
In terminal you can do it too:
date "+%Y-%m-%d_%H-%M-%S_"
or
datetime=$(date "+%Y-%m-%d_%H-%M-%S_")
Most humans talk about (month, date) tuples. US dates are big endian and written mm/dd. 12/25, 10/1, 2/28. They are elegant and compact and visually sort in the correct way eleven times out of twelve (11/12.)
Short UK dates are spoken as “Jan 9th” “8th of March” and written as such, or sometimes “Feb 9”. I find them very less pleasing.
Longer UK dates in Guardian format are prettier: 3 Jan 2022.
US dates inevitably have to be unambiguous about years. This is indeed unwieldy because a slashed triple — 3/4/22 — is used in the UK too. (The slashed pair is uncommon so it’s clear that 3/4 is an American date.)
Anything technical should indeed use ISO, but if you have an audience in a single locale it’s important to know your audience and localize (localise) accordingly.
2021-02-26T12:25:04Z
or 2020-01-30T03:14:15+05:00
but turns out its the same oneIt’s always “Why are the dates all American format? Can you change them to English?” And then I try to patiently explain that they’re actually international format.
People seem to have internalised that any date format they find slightly unfamiliar is “the bad American one”
I’m in the process of cutting everything I can over to “24th Jan 2020” style.
I hold the line, and I will die on this hill.
Job done
yyyymmdd
is also right and allowed in ISO 8601. Especially useful when you add time. You don't e.g. want character ":" in your file name 20210226T205418 (local time here)
That’s not the point.
The point is that in the US people typically work Mon-Fri and loaf around Sat-Sun (weekend) and yet the week starts in Sundays.
It’s infuriating.
So now when we rest, both the Jews and the Christians get their favorite day off and yay, we have a two-day weekend.
A year corresponds to an actual revolution of the Earth about the Sun, i.e., seasons.
A week corresponds to...nothing. Four of them are a (very) rough estimate of the phases of the moon, but that's not something that really matters to anyone other than sailors nowadays.
The practical difference is that inconsistent calendar representations make them a pain to use.
In reality there is no week end. The only periods that exist are days and years (and lunar cycles). Weeks are artificially constructed and it can begin and end whenever we want. I can see the sense in saying the week ends at the end of Sunday so the weekend is the bit before that. I can also see the sense in saying the week ends at the end of Saturday and the weekend is around that.
So presumably, you come from a Europe-centric view: http://chartsbin.com/view/41671
https://unicode-org.github.io/cldr-staging/charts/38/supplem...
Note that common usage and the official definition may well differ. Most Americans probably consider Monday the "first day of the week" as it is the first day in a standard work week. But officially, Sunday is the first day of the week.
Why does the US think that the week starts on Sunday?
I've read some historians state that Christians started using Sunday as their Sabbath day in order to distinguish themselves more sharply from the Jews.
There are some Christian denominations which use Saturday as their Sabbath day, such as Seventh-day Adventist Church, so using Saturday as the holy day is a minority practice among Christians but it's a significant minority.
I'm an iOS developer, and whenever I print dates, I just ask the system to print it, according to the system its locale.
this change to starting the week on monday is therefore a recent development.
same in china btw. days in china are numbered. monday is number 1, and sunday is 7. so while people may have the idea that the week starts on sunday (i don't know) the day numbering suggests that it actually starts on monday.
same goes for europe. monday by law and sunday by tradition
My understanding is that all days except Sunday "week-day" (星期日) are numbered. Monday is (星期一) "week-one". So there is still some room for ambiguity left if you allow for counting from 0.
The Hebrews did -- a long, long, long time ago.
Sunday is the first day of the week in almost all of the Americas, Japan, South Korea, and China.
Monday is the first day in Europe and some (relatively) recent European colonies (e.g., India).
The numbering of the days of the week is purely arbitrary. It makes no sense to claim that a particular ordering is "wrong".
If one goes by the sheer number of people who use a particular numbering, Americas + China comfortably exceeds Europe + recent European colonies.