GNU bug report logs -
#15927
Bug in date command
Previous Next
Reported by: Claudio Pinto <xclaudiojp <at> gmail.com>
Date: Tue, 19 Nov 2013 17:01:02 UTC
Severity: normal
Tags: notabug
Done: Bob Proulx <bob <at> proulx.com>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 15927 <at> debbugs.gnu.org (full text, mbox):
tag 15927 + moreinfo
thanks
Claudio Pinto wrote:
> date --date=10/20/2013
> result in
> date: invalid date `10/20/2013'
In what timezone?
You didn't give your timezone therefore it is impossible to know for
sure but your problem statement matches one of the very common cases
where Daylight Saving Time changes and therefore creates an invalid
date in your timezone.
Since you don't specify a time the time of 00:00 implicit. Better to
work with raw dates around 12:00 noon which avoids all known timezone
DST changes. Using the raw 'date' output gives ambiguous timezones.
Better to use the standardized and unambiguous -R format.
$ date -R --date=10/20/2013
Sun, 20 Oct 2013 00:00:00 -0600
$ date -R --date="10/20/2013 12:00"
Sun, 20 Oct 2013 12:00:00 -0600
Even better is to always do date calculations in UTC to avoid any DST
problems entirely.
$ date -u -R --date=10/20/2013
Sun, 20 Oct 2013 00:00:00 +0000
Please see the FAQ for a detailed discussion of date and DST.
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
Bob
This bug report was last modified 11 years and 187 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.