Bug 59444

Summary: date --date assumes US-style format regardless of locale setting
Product: [Retired] Red Hat Linux Reporter: jwitford
Component: sh-utilsAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-02-15 21:56:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jwitford 2002-02-08 00:32:15 UTC
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):
2.0.1

How Reproducible:
Always

Steps to Reproduce:
1.  date --date 1/12/2001 +%m
2.  date --date 2001/12/1 +%m
3. 

Actual Results:
1. 1
2. 12

Expected Results:
1. 12
2. 12

Additional Information:
Either need to add something to locale definitions, or have "date" examine LC_TIME and take special action if xx_US

Comment 1 Bernhard Rosenkraenzer 2002-02-15 12:55:38 UTC
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.

Comment 2 jwitford 2002-02-15 13:58:55 UTC
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!




Comment 3 Preston Brown 2002-02-15 15:38:52 UTC
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.


Comment 4 jwitford 2002-02-15 21:56:49 UTC
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.


Comment 5 Bernhard Rosenkraenzer 2002-08-29 19:42:31 UTC
POSIX (which demanded the collation order change) mandates the current date
behavior.