bug-coreutils
[Top][All Lists]
Advanced

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

bug#22397: Date -- Format arithemtic yields unexpected results


From: Pádraig Brady
Subject: bug#22397: Date -- Format arithemtic yields unexpected results
Date: Mon, 18 Jan 2016 14:16:05 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

tag 22397 notabug
close

On 18/01/16 03:53, Adam Danischewski wrote:
> $> date
> Sun Jan 17 22:49:40 EST 2016
> $> date -d"04:00"
> Sun Jan 17 04:00:00 EST 2016
> $> date -d"04:00 +1 day"
> Sun Jan 17 22:00:00 EST 2016
> 
> To fix this, a work around for me now is:
> $> date -d"$(date -d"04:00") +1 day"
> Mon Jan 18 04:00:00 EST 2016

The +1 is taken as a timezone offset.
You'll want:

date -d '04:00 today +1 day'

Note also the relative date discussion at:
http://bugs.gnu.org/18159

cheers,
Pádraig.





reply via email to

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