Bug 59444 - date --date assumes US-style format regardless of locale setting
date --date assumes US-style format regardless of locale setting
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: sh-utils (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-02-07 19:32 EST by jwitford
Modified: 2007-04-18 12:40 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-02-15 16:56:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description jwitford 2002-02-07 19:32:15 EST
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 07:55:38 EST
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 08:58:55 EST
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 10:38:52 EST
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 16:56:49 EST
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 15:42:31 EDT
POSIX (which demanded the collation order change) mandates the current date
behavior.

Note You need to log in before you can comment on or make changes to this bug.