GNU bug report logs - #15927
Bug in date command

Previous Next

Package: coreutils;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15927 in the body.
You can then email your comments to 15927 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#15927; Package coreutils. (Tue, 19 Nov 2013 17:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Claudio Pinto <xclaudiojp <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 19 Nov 2013 17:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Claudio Pinto <xclaudiojp <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Bug in date command
Date: Tue, 19 Nov 2013 10:23:39 -0200
[Message part 1 (text/plain, inline)]
date --date=10/20/2013

result in

date: invalid date `10/20/2013'

version:

date (GNU coreutils) 8.13
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#15927; Package coreutils. (Tue, 19 Nov 2013 18:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 15927 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Claudio Pinto <xclaudiojp <at> gmail.com>, 15927 <at> debbugs.gnu.org
Subject: Re: bug#15927: Bug in date command
Date: Tue, 19 Nov 2013 11:46:28 -0700
[Message part 1 (text/plain, inline)]
tag 15927 needinfo
thanks

On 11/19/2013 05:23 AM, Claudio Pinto wrote:
> date --date=10/20/2013
> 
> result in
> 
> date: invalid date `10/20/2013'

We need more details, such as your current timezone.  I suspect that you
are running into a FAQ:

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

in that you are probably in a timezone where daylight savings changed
your time from midnight to 1am at the very start of that particular day,
and therefore where there is no effective midnight on that date.  But as
I don't know what timezone you are in, I haven't managed to reproduce it
locally (in my timezone, daylight savings changes occur at 2am rather
than midnight).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Added tag(s) moreinfo. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 19 Nov 2013 18:47:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#15927; Package coreutils. (Tue, 19 Nov 2013 18:48:01 GMT) Full text and rfc822 format available.

Message #13 received at 15927 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Claudio Pinto <xclaudiojp <at> gmail.com>
Cc: 15927 <at> debbugs.gnu.org
Subject: Re: bug#15927: Bug in date command
Date: Tue, 19 Nov 2013 11:47:04 -0700
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




Information forwarded to bug-coreutils <at> gnu.org:
bug#15927; Package coreutils. (Tue, 19 Nov 2013 20:15:02 GMT) Full text and rfc822 format available.

Message #16 received at 15927 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Claudio Pinto <xclaudiojp <at> gmail.com>
Cc: 15927 <at> debbugs.gnu.org
Subject: Re: bug#15927: Bug in date command
Date: Tue, 19 Nov 2013 13:14:48 -0700
tag 15927 - moreinfo + notabug
close 15927
thanks

Hello Claudio,

Please keep the bug log in the recipient list.  That way others in the
team on the mailing list can participate in the discussion.

Claudio Pinto wrote:
> Current default time zone: 'America/Sao_Paulo'
> Local time is now:      Ter Nov 19 17:10:40 BRST 2013.
> Universal Time is now:  Tue Nov 19 19:10:40 UTC 2013.
>
> Here in Brazil we have the time in an hour early.

Yes.  And that is the problem.  The time you have specified does not
exist.  That is what makes it an invalid time.

  $ zdump -v America/Sao_Paulo | grep Oct.*2013
  America/Sao_Paulo  Sun Oct 20 02:59:59 2013 UTC = Sat Oct 19 23:59:59 2013 BRT isdst=0 gmtoff=-10800
  America/Sao_Paulo  Sun Oct 20 03:00:00 2013 UTC = Sun Oct 20 01:00:00 2013 BRST isdst=1 gmtoff=-7200

In the America/Sao_Paulo timezone as shown above the seconds of the
clock tick to "Oct 19 23:59:59 2013 BRT" and the very next tick of the
clock is "Sun Oct 20 01:00:00 2013 BRST".  But you are asking for
"Sun Oct 20 00:00:00" which does not exist in either BRT or BRST.

Note that this is not a technology issue.  This is an issue of
changing the clock for Daylight Saving Time.  Most countries do this
by an act of government.

> Removing a difference an hour, with the command below, the error does not
> happen ...
> date --date="10/20/2013 01:00"
> with the command below error appears:
> date --date="10/20/2013 00:59"

Correct.  Because those are invalid according to your
America/Sao_Paulo timezone.  To avoid those errors either use UTC
which does not change for Daylight Saving Time or use 12:00 noon to
avoid being near the time that it changes.

Since this is a bug in usage and not a bug in the date calculations I
am going to close the bug report.  However if things are still not
clear please feel free to follow up with any responses or comments and
we can keep discussing it.

Please keep the bug log address in the recipient list.

Bob




Removed tag(s) moreinfo. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Tue, 19 Nov 2013 20:15:04 GMT) Full text and rfc822 format available.

Added tag(s) notabug. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Tue, 19 Nov 2013 20:15:04 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 15927 <at> debbugs.gnu.org and Claudio Pinto <xclaudiojp <at> gmail.com> Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Tue, 19 Nov 2013 20:15:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 18 Dec 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 186 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.