Timeline for Is there any technical reason why, in programming, the default date format is YYYYMMDD and not something else?
Current License: CC BY-SA 4.0
45 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 23, 2020 at 17:18 | comment | added | Greg Woods | An equally valid, non-programming question, is "Why does the US use the dumbest of all date formats - Month Date Year? | |
| Oct 4, 2018 at 17:49 | comment | added | Aphton | Because it is ordered by its significance. When you write down five-hundred thirty one dollars in numbers, you don't write 135, in reverse significance order, but 531. And since it is ordered by significance, talking about YYYYMMDD, you can simply compare them to each other. | |
| Oct 2, 2018 at 15:37 | comment | added | Daniel Pryden | @PieterB: I think that's my point. ISO 8601 is a good standard, but it's not "the default". RFC 822 was the internet standard for a long time, and lots of people wrote lots of dates in ways that were incompatible with ISO 8601. Not to mention using epoch timestamps, which I think is probably even more of a "default" than any text-based format. I'm not arguing whether ISO 8601 is a good idea, or whether the question is indirectly referencing ISO 8601, I'm just saying that the premise of the question is incorrect. Perhaps the question should be phrased "why is ISO 8601 a good idea?" instead. | |
| Oct 2, 2018 at 13:42 | comment | added | Pieter B | @DanielPryden nowhere in either RFC 822 or 850 nor in asctime do you have anything which resembles YYYYMMDD, so when you see 20181002 as a date you can be very sure it's not a date from those specs, there is no ambiguity. | |
| Oct 2, 2018 at 9:48 | comment | added | ikegami | I don't see any mention of this additional reason: Of the three alternative orderings (y-m-d, m-d-y and d-m-y), only y-m-d is unambiguous. | |
| Sep 30, 2018 at 6:00 | history | tweeted | twitter.com/StackSoftEng/status/1046278668669071360 | ||
| S Sep 28, 2018 at 19:18 | history | suggested | TylerH | CC BY-SA 4.0 | Removed introductory fluff |
| Sep 28, 2018 at 17:14 | review | Suggested edits | |||
| S Sep 28, 2018 at 19:18 | |||||
| Sep 28, 2018 at 6:59 | comment | added | leo | Judging from en.wikipedia.org/wiki/Date_format_by_country this is also the primary, or one of two or three primary formats for around one third of the worlds' population | |
| Sep 27, 2018 at 20:40 | answer | added | Caius Jard | timeline score: -1 | |
| Sep 27, 2018 at 15:32 | comment | added | aroth | Technically speaking, the default date storage format is (or at least, should be) epoch milliseconds (or seconds, if you prefer) UTC. Years/months/dates are all purely presentation concerns, because humans are bad at parsing epoch timestamps. | |
| Sep 27, 2018 at 5:32 | comment | added | Blair Fonville | “a YEAR is more specific than a MONTH” - might be semantics, but you have that backwards. If your boss said “we’re on a deadline. I need your code submitted in 2018”, you might say “can you be more specific?” I think maybe you mean “more unique”. | |
| Sep 26, 2018 at 22:07 | answer | added | Stop harming Monica | timeline score: 0 | |
| Sep 26, 2018 at 19:48 | comment | added | David Aldridge | As @Robert says, in RDBMSs the internal and presentation formats are often different, not least because it is currently the year 2018 only in the Gregorian calendar. It is currently the year 1440 in the Islamic calendar, 4715 in the traditional Chinese, and 5779 in the Hebrew calendar. They are all different presentation formats, and some RDBMS will let you use various non-Gregorian calendars: docs.oracle.com/database/121/NLSPG/applocaledata.htm#NLSPG594 | |
| Sep 26, 2018 at 19:11 | answer | added | Rob | timeline score: 1 | |
| Sep 26, 2018 at 19:08 | comment | added | Daniel Pryden | In programming, the default date format is "YYYYMMDD"? It would be nice if that were true, but that's definitely not the case everywhere. RFC 822 and RFC 850, as well as ANSI C's asctime, are still widely used in a lot of places. It's nice that RFC 3339 and ISO 8601 are gradually displacing the older formats, and they're certainly what should be used going forward. More generally, I would say the ISO 8601 basic form (plain YYYYMMDD without separator characters) is actually less common than some other forms, like YYYY-MM-DD. | |
| Sep 26, 2018 at 18:16 | comment | added | user91988 | It follows alphanumerical order. That's really all there is to it. Since 19990514 is greater than 19990122, it's obvious that it's a later date. Makes comparisons super simple. | |
| Sep 26, 2018 at 14:24 | comment | added | Sensoray | I'd say the main reason is probably drilling down. You always start from something broad and then down to the specific. A year is a long range of time, a month is shorter and a day is shortest. From there we go to an hour-min-sec, largest to smallest. Just like if we read a number: 284.301, we start with the largest number and then as we read to the right, it gets smaller and more specific. | |
| Sep 26, 2018 at 13:39 | history | notice added | maple_shaft♦ | Needs detailed answers | |
| Sep 26, 2018 at 7:45 | answer | added | Ben | timeline score: 0 | |
| Sep 26, 2018 at 7:01 | comment | added | jwenting | @HonzaBrabec I DO like it, a LOT. Enough so I tend to use it when not programming :) | |
| Sep 25, 2018 at 22:49 | history | protected | gnat | ||
| Sep 25, 2018 at 20:50 | comment | added | Neinstein | As a side note, this format is not that alien. For example, in Hungarian language (and probably some others too) YYYY. MM. DD. is the default written date format, and has been a long time before computers. | |
| Sep 25, 2018 at 18:18 | comment | added | Joel Coehoorn | @Helio That xkcd comic has a mistake. One of the "discouraged" formats is allowed by the ISO standard. For historical reasons there are actually locale issues for some cultures with the "usuall" format for date-only values in some dialects of SQL (namely Sql Server), such that the unseparated format is actually preferred. DateTime values should still used full separated format -- though even a lot of Sql Server people don't know about this. | |
| Sep 25, 2018 at 13:53 | answer | added | Pod | timeline score: 58 | |
| Sep 25, 2018 at 13:19 | comment | added | 0x2b3bfa0 | xkcd.com/1179 | |
| Sep 25, 2018 at 9:57 | answer | added | Martin | timeline score: 12 | |
| Sep 25, 2018 at 9:56 | comment | added | Robert | I want to address 1 area of this question that has been neglected, the OP asked about dates in the context of an RDBMS. In this case the storage and presentation are different and most database tools allow the presentation to be configured to your local preference. That siad Pieter's answer is complete and correct in specifying the reason for writing dates year/month/day: softwareengineering.stackexchange.com/a/378936/15931 | |
| Sep 25, 2018 at 9:00 | answer | added | MSalters | timeline score: 136 | |
| Sep 25, 2018 at 8:56 | comment | added | gorn | @lucaswxp - it has been mentioned already, but have a look at what Lexicographical order is about. It is default on many places and also easy to implement and very fast, therefore preferred. | |
| Sep 25, 2018 at 8:31 | answer | added | mrvinent | timeline score: 4 | |
| Sep 25, 2018 at 7:55 | comment | added | Dave Sherohman | @IMil - Even so, it's still common for programmers to use date strings instead of the database's dedicated date type. | |
| Sep 25, 2018 at 7:40 | comment | added | glglgl | @candied_orange That would be strange, especially in the case of dates. | |
| Sep 25, 2018 at 7:19 | comment | added | IMil | @HonzaBrabec sure, they often do, but the OP mentioned RDBMS, and any decent DB has a separate date type | |
| Sep 25, 2018 at 7:14 | answer | added | WolfgangGroiss | timeline score: 5 | |
| Sep 25, 2018 at 7:00 | comment | added | Honza Brabec | @IMil We may not like it, but quite often they are stored as strings. | |
| Sep 25, 2018 at 6:40 | answer | added | mckenzm | timeline score: 6 | |
| Sep 25, 2018 at 5:50 | review | Close votes | |||
| Sep 30, 2018 at 3:05 | |||||
| Sep 25, 2018 at 4:31 | answer | added | zahbaz | timeline score: 19 | |
| Sep 25, 2018 at 4:02 | answer | added | Joel Coehoorn | timeline score: 7 | |
| Sep 25, 2018 at 3:24 | comment | added | candied_orange | Sorting is not performed on the internal representation but on the presented one. | |
| Sep 25, 2018 at 3:23 | comment | added | IMil | Performance is not an issue in this case: dates are not stored as strings internally. | |
| Sep 25, 2018 at 0:18 | answer | added | Pieter B | timeline score: 56 | |
| Sep 24, 2018 at 22:49 | answer | added | Arseni Mourzenko | timeline score: 396 | |
| Sep 24, 2018 at 22:43 | history | asked | lucaswxp | CC BY-SA 4.0 |