Is there any technical reason why, in programming, the default date format is YYYYMMDD and not something else?
Clash 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?
sql engineering rdbms date-format
add a comment |Â
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?
sql engineering rdbms date-format
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
add a comment |Â
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?
sql engineering rdbms date-format
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
sql engineering rdbms date-format
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
add a comment |Â
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
add a comment |Â
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.
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
add a comment |Â
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?)
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
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?)
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
add a comment |Â
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?)
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
add a comment |Â
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?)
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?)
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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