Red Hat Bugzilla – Bug 59444
date --date assumes US-style format regardless of locale setting
Last modified: 2007-04-18 12:40:02 EDT
Description of Problem:
"Date --date" always assumes US-ordered mm/dd/YYYY regardless of locale setting. The US is the only country that uses the illogical mm/dd/YYYY
dates; everyone else uses dd/mm/YYYY. There is currently no locale setting to control this.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. date --date 1/12/2001 +%m
2. date --date 2001/12/1 +%m
Either need to add something to locale definitions, or have "date" examine LC_TIME and take special action if xx_US
This is true; however, people (and their scripts) have come to expect this behavior
because it has been that way forever. I'm not sure this should be fixed.
It should be fixed.
The longer it is left then the more people might make more erroneous assumptions in their scripts.
And since the --date option accepts fairly free-form input (eg 2002/02/01, or 02/01/2002) it should
conform with user's locale. Usually the date will derive from other data in locale's format.
A fix will not affect any US script and us foreigners would really appreciate a fix because all our dates
appear as 01/02/2002 and it is just plain silly if we have to mangle the date just to satisfy the --date option.
Surely that is what locale's are all about - fixing this sort of problem!
Unfortunately, in this case, "fixing" the problem could cause more harm than
it is worth.
I think that the only real solution would be to extend the date command with
a --localedate command, so as not to break existing usage, as Bero mentions.
But "... could cause more harm than it is worth ..." never stopped someone from changing "ls" collation order!
A correction would not affact ANY user in the USA.
It is a bug because it doesn't behave as expected.
Moreover any workaround will usually involve the transformation of dd/mm/yyyy to yyyy/mm/dd because
the latter form is unambiguous and always works. I couldn't imagine anybody doing a transformation
of dd/mm/yyyy to mm/dd/yyyy as a workaround.
POSIX (which demanded the collation order change) mandates the current date