bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DATE command


From: Bob Proulx
Subject: Re: DATE command
Date: Mon, 15 Feb 2010 14:31:15 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

Robert wrote:
> That is, until you run into this kind of weirdness in which "date" groks  
> "CST", "EDT" and "EST" but throws up its hands at the thought of Central  
> Daylight Time.

Thank you for the report.  But what you are seeing is not a bug in
date but is a misunderstanding of when daylight savings time is active
in your timezone.  DST is valid from April to October and December
uses standard time.  Therefore your use of DST in December is invalid.

You are better off using UTC in all such cases.  It avoids problems
with DST.  You are simply running into a DST problem.  Remember, that
DST is in place by Act Of Congress.  It isn't a technical problem. :-)

> address@hidden ~]$ date -d "Dec 21 2004   7:42 AM CDT" +%s
> date: invalid date `Dec 21 2004   7:42 AM CDT'

Right.  There is no such time.  It is invalid.  Date correctly reports
this to you.

  $ zdump -v US/Central | grep '200[45]'
  US/Central  Sun Apr  4 07:59:59 2004 UTC = Sun Apr  4 01:59:59 2004 CST 
isdst=0 gmtoff=-21600
  US/Central  Sun Apr  4 08:00:00 2004 UTC = Sun Apr  4 03:00:00 2004 CDT 
isdst=1 gmtoff=-18000
  US/Central  Sun Oct 31 06:59:59 2004 UTC = Sun Oct 31 01:59:59 2004 CDT 
isdst=1 gmtoff=-18000
  US/Central  Sun Oct 31 07:00:00 2004 UTC = Sun Oct 31 01:00:00 2004 CST 
isdst=0 gmtoff=-21600
  US/Central  Sun Apr  3 07:59:59 2005 UTC = Sun Apr  3 01:59:59 2005 CST 
isdst=0 gmtoff=-21600
  US/Central  Sun Apr  3 08:00:00 2005 UTC = Sun Apr  3 03:00:00 2005 CDT 
isdst=1 gmtoff=-18000
  US/Central  Sun Oct 30 06:59:59 2005 UTC = Sun Oct 30 01:59:59 2005 CDT 
isdst=1 gmtoff=-18000
  US/Central  Sun Oct 30 07:00:00 2005 UTC = Sun Oct 30 01:00:00 2005 CST 
isdst=0 gmtoff=-21600

As you can see CDT is not valid at any time in December.

You also see this by experimentation.

  $ TZ=US/Central date -d "Dec 21 2004   7:42 AM CDT"
  date: invalid date `Dec 21 2004   7:42 AM CDT'

  $ TZ=US/Central date -d "Dec 21 2004   7:42 AM CST"
  Tue Dec 21 07:42:00 CST 2004

Please see this reference for more information.

  
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]