bug-coreutils
[Top][All Lists]
Advanced

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

bug#8648: bug in date?


From: Ondrej Vasik
Subject: bug#8648: bug in date?
Date: Wed, 11 May 2011 06:31:56 +0200

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







reply via email to

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