[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: date command
From: |
Bob Proulx |
Subject: |
Re: date command |
Date: |
Tue, 4 Oct 2011 20:25:12 -0600 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
s.ploss@juno.com wrote:
> Bash Version: 4.1
>
> When using date command with -d option, if the date is between
> "2010-03-14 02:00" and "2010-03-14 02:59" inclusive, it gives an
> "invalid date" error. You can test this with the following command:
> echo $(date -d "2010-03-14 02:00" +%s)
> Dates outside this range work fine.
First, 'date' is a coreutils command, not a 'bash' command. Bugs in
'date' should be reported to the bug-coreutils mailing list not the
bug-bash mailing list.
Second, what you are seeing is almost certainly due to daylight saving
time being in effect and skipping over that time interval. In my
US/Mountain timezone those dates are invalid and do not exist.
$ TZ=US/Mountain date -d '2010-03-14 02:59'
date: invalid date `2010-03-14 02:59'
The above is correct behavior since by Act of Congress DST changed
then and skipped that hour.
$ zdump -v US/Mountain | grep 2010
US/Mountain Sun Mar 14 08:59:59 2010 UTC = Sun Mar 14 01:59:59 2010 MST
isdst=0 gmtoff=-25200
US/Mountain Sun Mar 14 09:00:00 2010 UTC = Sun Mar 14 03:00:00 2010 MDT
isdst=1 gmtoff=-21600
US/Mountain Sun Nov 7 07:59:59 2010 UTC = Sun Nov 7 01:59:59 2010 MDT
isdst=1 gmtoff=-21600
US/Mountain Sun Nov 7 08:00:00 2010 UTC = Sun Nov 7 01:00:00 2010 MST
isdst=0 gmtoff=-25200
See this FAQ entry for more information:
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
Bob