Timeline for answer to Is there any technical reason why, in programming, the default date format is YYYYMMDD and not something else? by Arseni Mourzenko
Current License: CC BY-SA 4.0
Post Revisions
36 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Oct 20, 2018 at 0:54 | history | suggested | Ed Avis | CC BY-SA 4.0 |
Updated to note that this format is one ot those defined by ISO 8601, as a commenter pointed out.
|
| Oct 4, 2018 at 7:37 | review | Suggested edits | |||
| S Oct 20, 2018 at 0:54 | |||||
| Oct 3, 2018 at 13:51 | comment | added | Monty Harder | @boris They can certainly adopt a different scheme, but it will cost them backward compatibility. Neither of us will be around to undertake the task of converting ISO-8601 dates to a new scheme, so it's also unfair for us to saddle those future humans with Y10K problems. | |
| Oct 2, 2018 at 13:59 | comment | added | user288233 | @MontyHarder it's unfair that over the next million years 99% of humans should have to prefix their date with a nonsensical character just so 1% of humans (us and people alive in the next 8000 years) wouldn't have to. | |
| Oct 2, 2018 at 9:55 | review | Suggested edits | |||
| Oct 3, 2018 at 6:17 | |||||
| S Oct 1, 2018 at 6:21 | history | suggested | Basil Bourque | CC BY-SA 4.0 |
Linked to Wikipedia for technical term.
|
| Sep 27, 2018 at 21:53 | review | Suggested edits | |||
| S Oct 1, 2018 at 6:21 | |||||
| S Sep 27, 2018 at 19:14 | history | suggested | Oskar Austegard | CC BY-SA 4.0 |
minor verbiage edit for clarity
|
| Sep 27, 2018 at 18:59 | review | Suggested edits | |||
| S Sep 27, 2018 at 19:14 | |||||
| Sep 27, 2018 at 17:56 | comment | added | LarsH | DanWilson's point is key: If I'm writing a tool that sorts by date, I can make it intelligent about how to parse the date; but if I'm using someone else's tools, they're much more likely to be able to sort alphabetically (for ASCII characters at least) without special configuration, than to be able to sort according to a specific date format. | |
| Sep 27, 2018 at 17:39 | comment | added | Monty Harder | @dan04 I took that RFC as a starting point and modified it slightly to avoid the need to add caret prefixes, by adding the bit about adding digits three at a time to conserve alpha prefixes. Yes, I realize it was originally a joke, but it's also a practical solution to the problem. | |
| Sep 27, 2018 at 13:54 | comment | added | Yakk | @paul23 Well, without doing anything fancy, the arrow of time starts breaking down as you approach heat death. Arrow of time as we experience it is the gradient of entropy, and heat death is a universe with no entropy gradients left. So as you approach it going "forward" and "backward" in time becomes increasingly symmetrical. Having a "you" present to experience it becomes impossible, as a "you" implies narrative consciousness, and that requires an arrow of time to experience consciousness. Forward and backward in time becomes symmetric, with the exception of some far off (invisible) event. | |
| Sep 27, 2018 at 13:09 | comment | added | VLAZ | @Aaron I'd love to see a move or something about IT admins and/or programmers at work in the last moments before the universe ends as they try to do everything they can to keep the systems working, while the laws of physics stop working. | |
| Sep 26, 2018 at 22:30 | comment | added | Aaron | @paul23 But that makes the hypothetical thought less humorous. :( I was enjoying thinking about the end of time as if it would be business as usual. Sad but funny. | |
| Sep 26, 2018 at 22:19 | comment | added | paul23 | @Aaron when you are no longer talking about time in a linear fashion it also starts meaning that if you t=x and a delta-t, dt=y, t+dt != x+y, so yes a "30 year loan" at heat death (if the hypothesis that time itself is also a fundamental field holds) would be over at the instant it is "given", as at that point t+t2 = t for all t2. | |
| Sep 26, 2018 at 22:13 | comment | added | Aaron | @paul23 My point was that even with such an end date, you might need to represent a date which does not exist. If there is a time you cannot reach, you might still need an abstract representation of that non-existing time in your software. Although, I suppose your suggestion of non-linear time might change how we even view the algorithm in that software. Still, I suggest you might have such a need. "What do you mean I can't take out a conventional loan just because my payments will be due at a time that doesn't exist? You still need to abide by the law, and I qualify for this 30 year loan!" | |
| Sep 26, 2018 at 21:43 | comment | added | paul23 | @Aaron I don't think so, with the heat death we might also experience that time doesn't flow linearly anymore (just like at the big bang, the most accepted theory is that time reaches a singularity at the big bang, and thus there is no "negative time"). If time is also part of the fundamental forces, it would mean that it too breaks down and there is literary and "end date" that we approach but can never reach. | |
| Sep 26, 2018 at 19:54 | comment | added | David Aldridge | It's true that YYYYMMDD can be sorted as a string correctly, but an RDBMS such as Oracle does not store, nor sort, date values as a string. Oracle in particular has an internal representation of the date as seven bytes representing century, year, month, day, hour, minute, second, to which the sort is applied (so it includes time as well, which would take 14 bytes if it were a string). So it is in YYYYMMDDhhmmss order, but sort-of numerical. stackoverflow.com/questions/13568193/… | |
| Sep 26, 2018 at 19:32 | comment | added | Aaron | @CortAmmon Even if they are not thinking ahead for use past universal heat death, there could still be a need for dates beyond the heat death which will not be experienced personally. Even if the end date of that format coincided exactly with the end of everything, imagine someone getting a 30 year mortgage loan 10 years before the end and requesting an amortization table from the software. That customer won't take "the universe is ending in 20 years" as an excuse for the failure to provide payment details. | |
| S Sep 26, 2018 at 17:08 | history | suggested | einpoklum | CC BY-SA 4.0 |
use of the formal term for the "default" sort order for strings
|
| Sep 26, 2018 at 15:36 | comment | added | ps2goat |
It can also be confusing if you don't put the year first. This YYYYMMDD standard (though I prefer the ISO dashes) makes it easier to know which is the month and which is the day. If your application runs in multiple locales, your US users may be used to month/day/year, while the UK is used to day/month/year.
|
|
| Sep 26, 2018 at 15:02 | review | Suggested edits | |||
| S Sep 26, 2018 at 17:08 | |||||
| Sep 26, 2018 at 9:10 | history | edited | Arseni Mourzenko | CC BY-SA 4.0 |
added 11 characters in body
|
| Sep 26, 2018 at 7:56 | comment | added | phresnel | You can also sort "DDMMYYYY" as strings, simply by starting at the end for comparison. What you really mean is lexicographic sorting. | |
| Sep 25, 2018 at 19:44 | comment | added | dan04 | @Benoit: Monty seems to be referring to RFC 2550 - Y10K and Beyond. | |
| Sep 25, 2018 at 17:25 | comment | added | Cort Ammon | @MontyHarder I can't wait to see the standards discussion on the day they finally decide to add one more digit than absolutely necessary, thinking ahead for 1000 billion years in the future. (See also the NTP datestamps) | |
| Sep 25, 2018 at 15:39 | comment | added | jpmc26 | It's important to note that with this format, sorting isn't just "easier." The lexical (character based) sort becomes equivalent to the temporal sort, which means you can sort temporally without parsing. | |
| Sep 25, 2018 at 15:00 | comment | added | Monty Harder | @Benoit A proposal has already been made to solve the Y10K problem. If we're still using the same era then, we'll go to AYYYYYMMDD until Y100K, which will be BYYYYYYMMDD, CYYYYYYYMMDD, DYYYYYYYYMMDD, EYYYYYYYYYMMDD. This leading alpha prefix assures correct sort order (provided that "A0YYYY..." etc. are invalid representations if any YYYY... dates are still used). At some point when the number of year digits are divisible by three, we'll start adding three digits each time we change alpha prefix, in order to assure we don't run out of letters before the heat death of the universe. | |
| Sep 25, 2018 at 13:57 | comment | added | Benoit | "This way, the dates can easily be sorted as strings: year first, then month, then day" - this istrue... until 31st December 9999. The 1st January 10000 will not be sorted correctly with this format. But none of us will be here to check that ;-) | |
| Sep 25, 2018 at 13:01 | history | edited | Arseni Mourzenko | CC BY-SA 4.0 |
added 187 characters in body
|
| Sep 25, 2018 at 11:14 | comment | added | Martin Ba | Note that the dashes are optional in ISO 8601, so YYYYMMDD is ISO 8601. | |
| Sep 25, 2018 at 5:00 | comment | added | emptyother | @lucaswxp Your date string might not be in memory. Practical example: You have a csv file already sorted by ISO date and millions+ of rows per year. And you want to return only the rows between certain dates. You can read the file line by line (row by row) until you reach your first date, then load rows into memory until you reach your last date. You can skip the rest of the file. But if you save the date as some other format, or sorted by year only, you would have to read trough the entire year worth of records before closing the file. | |
| Sep 25, 2018 at 0:48 | comment | added | Deduplicator | @lucaswxp: If you write a special-case comparison for strings following a specific schema, you can of course make it as baroque as you want. The thing here is that the schema is designed such that lexical order (as well as lexical number-aware order) is also logical order, so no need for customizing. | |
| Sep 25, 2018 at 0:34 | comment | added | Dan Wilson | @lucaswxp It also helps in Windows Explorer, Finder, etc. If you have a list of files or folders named by date then you don't have to sort them when enumerating. | |
| Sep 24, 2018 at 23:50 | comment | added | lucaswxp | Ok, but couldnt the sort be just as fast as long as you know where the year is located in the string? Because the whole date must be loaded into memory anyway, not only the year. | |
| Sep 24, 2018 at 22:49 | history | answered | Arseni Mourzenko | CC BY-SA 4.0 |