GNU bug report logs -
#8648
bug in date?
Previous Next
Reported by: "Turner, Neil" <tnturner <at> amazon.com>
Date: Tue, 10 May 2011 23:53:02 UTC
Severity: normal
Tags: notabug
Done: Jim Meyering <jim <at> meyering.net>
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 8648 in the body.
You can then email your comments to 8648 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8648
; Package
coreutils
.
(Tue, 10 May 2011 23:53:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Turner, Neil" <tnturner <at> amazon.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Tue, 10 May 2011 23:53:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Maybe found a bug in date... the following command:
$ date --date="yesterday 00:00 +1 day"
Mon May 9 16:59:00 PDT 2011
The date as I type this is May 10th... so I was expecting the output to be:
Tues May 10 00:00:00 PDT 2011
Thanks,
Neil
[Message part 2 (text/html, inline)]
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8648
; Package
coreutils
.
(Wed, 11 May 2011 04:33:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 8648 <at> debbugs.gnu.org (full text, mbox):
On Tue, 2011-05-10 at 16:36 -0700, Turner, Neil wrote:
> Maybe found a bug in date... the following command:
>
> $ date --date="yesterday 00:00 +1 day"
> Mon May 9 16:59:00 PDT 2011
>
> The date as I type this is May 10th... so I was expecting the output to be:
> Tues May 10 00:00:00 PDT 2011
First of all, please always report the version of coreutils where you
experience the unexpected behaviour.
However - it is a tricky thing - you are human, you know what you have
meant by +1 ... but flex getdate parser is not a human - and it simply
parses the date format. In this case date format expects +1 is timezone
(and because I see the offset of 1 minute, I think you have quite old
version of coreutils). +1 is then implicit for the relative time offset
(you may consider date --date="yesterday 00:00 +3 day" to be even more
"buggy"). Not too much to do, date parser is very fragile and you will
always have this kind of disambiguations there. So there is only one
hint, make the format as complete as possible (date time timezone
offset)...
With `date --date="yesterday 00:00 PDT +1 day"` you should get the date
you expected.
Greetings,
Ondrej Vasik
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#8648
; Package
coreutils
.
(Wed, 11 May 2011 06:01:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 8648 <at> debbugs.gnu.org (full text, mbox):
tag 8648 + notabug
close 8648
thanks
Ondrej Vasik wrote:
> On Tue, 2011-05-10 at 16:36 -0700, Turner, Neil wrote:
>> Maybe found a bug in date... the following command:
>>
>> $ date --date="yesterday 00:00 +1 day"
>> Mon May 9 16:59:00 PDT 2011
>>
>> The date as I type this is May 10th... so I was expecting the output to be:
>> Tues May 10 00:00:00 PDT 2011
>
> First of all, please always report the version of coreutils where you
> experience the unexpected behaviour.
>
> However - it is a tricky thing - you are human, you know what you have
> meant by +1 ... but flex getdate parser is not a human - and it simply
> parses the date format. In this case date format expects +1 is timezone
> (and because I see the offset of 1 minute, I think you have quite old
> version of coreutils). +1 is then implicit for the relative time offset
> (you may consider date --date="yesterday 00:00 +3 day" to be even more
> "buggy"). Not too much to do, date parser is very fragile and you will
> always have this kind of disambiguations there. So there is only one
> hint, make the format as complete as possible (date time timezone
> offset)...
>
> With `date --date="yesterday 00:00 PDT +1 day"` you should get the date
> you expected.
Thanks for the report, Neil, and for replying, Ondřej.
Neil, if you run "info date example", you'll see pretty many examples.
There are some here, too:
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e
BTW, simply removing the "+" should make date do what you
want most of the time:
$ date --date="yesterday 00:00 1 day"
However, that may well fail around DST changes (as explained
in detail via that FAQ), so you should use noon rather than midnight:
$ date --date="yesterday 12:00 1 day"
P.S. I've closed this ticket but you're welcome to continue discussing
and even to reopen it if I've missed something.
Added tag(s) notabug.
Request was from
Jim Meyering <jim <at> meyering.net>
to
control <at> debbugs.gnu.org
.
(Wed, 11 May 2011 16:40:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
8648 <at> debbugs.gnu.org and "Turner, Neil" <tnturner <at> amazon.com>
Request was from
Jim Meyering <jim <at> meyering.net>
to
control <at> debbugs.gnu.org
.
(Wed, 11 May 2011 16:40:02 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
.
(Thu, 09 Jun 2011 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 65 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.