Is there any technical reason why, in programming, the default date format is YYYYMMDD and not something else?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












The title is self explanatory. Sorry if that sounds like a newbie question, but I just can't seem to find the answer anywhere else.



Is there any engineering reason why is it like that? I was wondering in the case of a RDBMS that it had something to do with performance, since a "YEAR" is more specific than a "MONTH", for instance: you only have one year 2000, but every year have "January", which would make it easier/faster to filter/sort something by year first, and that's why the year comes first.



But I don't know if that really makes sense... Is there any reason at all?










share|improve this question

















  • 1




    It is a common format because it makes sorting easier. As for default, it really depends on the system, locale, and personal settings. Also, some locales have mm/dd/year others use dd/mm/yyyy making many dates ambiguous if you aren’t sure of the format.
    – Kristian H
    3 hours ago











  • it's also the ISO date definition and understood internationally.
    – Aganju
    3 hours ago
















up vote
2
down vote

favorite












The title is self explanatory. Sorry if that sounds like a newbie question, but I just can't seem to find the answer anywhere else.



Is there any engineering reason why is it like that? I was wondering in the case of a RDBMS that it had something to do with performance, since a "YEAR" is more specific than a "MONTH", for instance: you only have one year 2000, but every year have "January", which would make it easier/faster to filter/sort something by year first, and that's why the year comes first.



But I don't know if that really makes sense... Is there any reason at all?










share|improve this question

















  • 1




    It is a common format because it makes sorting easier. As for default, it really depends on the system, locale, and personal settings. Also, some locales have mm/dd/year others use dd/mm/yyyy making many dates ambiguous if you aren’t sure of the format.
    – Kristian H
    3 hours ago











  • it's also the ISO date definition and understood internationally.
    – Aganju
    3 hours ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











The title is self explanatory. Sorry if that sounds like a newbie question, but I just can't seem to find the answer anywhere else.



Is there any engineering reason why is it like that? I was wondering in the case of a RDBMS that it had something to do with performance, since a "YEAR" is more specific than a "MONTH", for instance: you only have one year 2000, but every year have "January", which would make it easier/faster to filter/sort something by year first, and that's why the year comes first.



But I don't know if that really makes sense... Is there any reason at all?










share|improve this question













The title is self explanatory. Sorry if that sounds like a newbie question, but I just can't seem to find the answer anywhere else.



Is there any engineering reason why is it like that? I was wondering in the case of a RDBMS that it had something to do with performance, since a "YEAR" is more specific than a "MONTH", for instance: you only have one year 2000, but every year have "January", which would make it easier/faster to filter/sort something by year first, and that's why the year comes first.



But I don't know if that really makes sense... Is there any reason at all?







sql engineering rdbms date-format






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 3 hours ago









lucaswxp

1574




1574







  • 1




    It is a common format because it makes sorting easier. As for default, it really depends on the system, locale, and personal settings. Also, some locales have mm/dd/year others use dd/mm/yyyy making many dates ambiguous if you aren’t sure of the format.
    – Kristian H
    3 hours ago











  • it's also the ISO date definition and understood internationally.
    – Aganju
    3 hours ago












  • 1




    It is a common format because it makes sorting easier. As for default, it really depends on the system, locale, and personal settings. Also, some locales have mm/dd/year others use dd/mm/yyyy making many dates ambiguous if you aren’t sure of the format.
    – Kristian H
    3 hours ago











  • it's also the ISO date definition and understood internationally.
    – Aganju
    3 hours ago







1




1




It is a common format because it makes sorting easier. As for default, it really depends on the system, locale, and personal settings. Also, some locales have mm/dd/year others use dd/mm/yyyy making many dates ambiguous if you aren’t sure of the format.
– Kristian H
3 hours ago





It is a common format because it makes sorting easier. As for default, it really depends on the system, locale, and personal settings. Also, some locales have mm/dd/year others use dd/mm/yyyy making many dates ambiguous if you aren’t sure of the format.
– Kristian H
3 hours ago













it's also the ISO date definition and understood internationally.
– Aganju
3 hours ago




it's also the ISO date definition and understood internationally.
– Aganju
3 hours ago










2 Answers
2






active

oldest

votes

















up vote
7
down vote













This way, the dates can easily be sorted as strings: year first, then month, then day.



This is also why both month and day are specified using two digits (adding a leading zero if needed).



The same sort logic works for ISO 8601 date format, when the date and time are represented like this: 2015-03-27T15:26:40Z.






share|improve this answer




















  • 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.
    – lucaswxp
    2 hours ago










  • @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.
    – Dan Wilson
    1 hour ago










  • @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.
    – Deduplicator
    1 hour ago

















up vote
0
down vote













It's because all the other ways to do it are ambiguous.



01/02/2003 what does that mean? January second 2003? Or in Europe: February 1st 2003?



That is why you use YYYYMMDD, it's the convention which enables us to communicate clearly about dates, 20030201 as a date is always clear. (and it makes it easier to sort)



(Now don't go storing that as the integer 20 million 30 thousand 2 hundred and 1. please ok? pretty please?)






share|improve this answer




















  • Following a convention, no mater how popular, does not resolve ambiguity. Only explicitly stating what convention you are following does. Doing what's popular only improves the odds of correct guesses.
    – candied_orange
    1 hour ago






  • 1




    @candied_orange using YYYYMMDD is following the ISO standard 8601.
    – Pieter B
    1 hour ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "131"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsoftwareengineering.stackexchange.com%2fquestions%2f378931%2fis-there-any-technical-reason-why-in-programming-the-default-date-format-is-yy%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
7
down vote













This way, the dates can easily be sorted as strings: year first, then month, then day.



This is also why both month and day are specified using two digits (adding a leading zero if needed).



The same sort logic works for ISO 8601 date format, when the date and time are represented like this: 2015-03-27T15:26:40Z.






share|improve this answer




















  • 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.
    – lucaswxp
    2 hours ago










  • @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.
    – Dan Wilson
    1 hour ago










  • @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.
    – Deduplicator
    1 hour ago














up vote
7
down vote













This way, the dates can easily be sorted as strings: year first, then month, then day.



This is also why both month and day are specified using two digits (adding a leading zero if needed).



The same sort logic works for ISO 8601 date format, when the date and time are represented like this: 2015-03-27T15:26:40Z.






share|improve this answer




















  • 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.
    – lucaswxp
    2 hours ago










  • @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.
    – Dan Wilson
    1 hour ago










  • @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.
    – Deduplicator
    1 hour ago












up vote
7
down vote










up vote
7
down vote









This way, the dates can easily be sorted as strings: year first, then month, then day.



This is also why both month and day are specified using two digits (adding a leading zero if needed).



The same sort logic works for ISO 8601 date format, when the date and time are represented like this: 2015-03-27T15:26:40Z.






share|improve this answer












This way, the dates can easily be sorted as strings: year first, then month, then day.



This is also why both month and day are specified using two digits (adding a leading zero if needed).



The same sort logic works for ISO 8601 date format, when the date and time are represented like this: 2015-03-27T15:26:40Z.







share|improve this answer












share|improve this answer



share|improve this answer










answered 3 hours ago









Arseni Mourzenko

109k25272441




109k25272441











  • 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.
    – lucaswxp
    2 hours ago










  • @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.
    – Dan Wilson
    1 hour ago










  • @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.
    – Deduplicator
    1 hour ago
















  • 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.
    – lucaswxp
    2 hours ago










  • @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.
    – Dan Wilson
    1 hour ago










  • @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.
    – Deduplicator
    1 hour ago















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.
– lucaswxp
2 hours ago




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.
– lucaswxp
2 hours ago












@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.
– Dan Wilson
1 hour ago




@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.
– Dan Wilson
1 hour ago












@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.
– Deduplicator
1 hour ago




@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.
– Deduplicator
1 hour ago












up vote
0
down vote













It's because all the other ways to do it are ambiguous.



01/02/2003 what does that mean? January second 2003? Or in Europe: February 1st 2003?



That is why you use YYYYMMDD, it's the convention which enables us to communicate clearly about dates, 20030201 as a date is always clear. (and it makes it easier to sort)



(Now don't go storing that as the integer 20 million 30 thousand 2 hundred and 1. please ok? pretty please?)






share|improve this answer




















  • Following a convention, no mater how popular, does not resolve ambiguity. Only explicitly stating what convention you are following does. Doing what's popular only improves the odds of correct guesses.
    – candied_orange
    1 hour ago






  • 1




    @candied_orange using YYYYMMDD is following the ISO standard 8601.
    – Pieter B
    1 hour ago














up vote
0
down vote













It's because all the other ways to do it are ambiguous.



01/02/2003 what does that mean? January second 2003? Or in Europe: February 1st 2003?



That is why you use YYYYMMDD, it's the convention which enables us to communicate clearly about dates, 20030201 as a date is always clear. (and it makes it easier to sort)



(Now don't go storing that as the integer 20 million 30 thousand 2 hundred and 1. please ok? pretty please?)






share|improve this answer




















  • Following a convention, no mater how popular, does not resolve ambiguity. Only explicitly stating what convention you are following does. Doing what's popular only improves the odds of correct guesses.
    – candied_orange
    1 hour ago






  • 1




    @candied_orange using YYYYMMDD is following the ISO standard 8601.
    – Pieter B
    1 hour ago












up vote
0
down vote










up vote
0
down vote









It's because all the other ways to do it are ambiguous.



01/02/2003 what does that mean? January second 2003? Or in Europe: February 1st 2003?



That is why you use YYYYMMDD, it's the convention which enables us to communicate clearly about dates, 20030201 as a date is always clear. (and it makes it easier to sort)



(Now don't go storing that as the integer 20 million 30 thousand 2 hundred and 1. please ok? pretty please?)






share|improve this answer












It's because all the other ways to do it are ambiguous.



01/02/2003 what does that mean? January second 2003? Or in Europe: February 1st 2003?



That is why you use YYYYMMDD, it's the convention which enables us to communicate clearly about dates, 20030201 as a date is always clear. (and it makes it easier to sort)



(Now don't go storing that as the integer 20 million 30 thousand 2 hundred and 1. please ok? pretty please?)







share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









Pieter B

10.3k12560




10.3k12560











  • Following a convention, no mater how popular, does not resolve ambiguity. Only explicitly stating what convention you are following does. Doing what's popular only improves the odds of correct guesses.
    – candied_orange
    1 hour ago






  • 1




    @candied_orange using YYYYMMDD is following the ISO standard 8601.
    – Pieter B
    1 hour ago
















  • Following a convention, no mater how popular, does not resolve ambiguity. Only explicitly stating what convention you are following does. Doing what's popular only improves the odds of correct guesses.
    – candied_orange
    1 hour ago






  • 1




    @candied_orange using YYYYMMDD is following the ISO standard 8601.
    – Pieter B
    1 hour ago















Following a convention, no mater how popular, does not resolve ambiguity. Only explicitly stating what convention you are following does. Doing what's popular only improves the odds of correct guesses.
– candied_orange
1 hour ago




Following a convention, no mater how popular, does not resolve ambiguity. Only explicitly stating what convention you are following does. Doing what's popular only improves the odds of correct guesses.
– candied_orange
1 hour ago




1




1




@candied_orange using YYYYMMDD is following the ISO standard 8601.
– Pieter B
1 hour ago




@candied_orange using YYYYMMDD is following the ISO standard 8601.
– Pieter B
1 hour ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsoftwareengineering.stackexchange.com%2fquestions%2f378931%2fis-there-any-technical-reason-why-in-programming-the-default-date-format-is-yy%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke