bug-coreutils
[Top][All Lists]
Advanced

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

bug#26081: --date=STRING error that started midnight 3/12


From: Pádraig Brady
Subject: bug#26081: --date=STRING error that started midnight 3/12
Date: Mon, 13 Mar 2017 21:06:02 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 13/03/17 05:17, Eric Blake wrote:
> tag 26081 notabug
> thanks
> 
> On 03/13/2017 12:09 AM, Fevzi Karavelioglu wrote:
>> Hello, I started getting an error with the following command:
>>
>> $> date --date="02:05 tomorrow" +%s
>> *date: invalid date `02:05 tomorrow'*
>>
>> It appears any time 2 in the morning causes the error. But everything else
>> appears to work fine. This appears to have started after midnight on March
>> 12 2017. May be something to do with daylight saving as it starts at 2AM?
> 
> Everything to do with daylight savings.  In fact, it's a FAQ:
> https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e
> 
> You're trying to start from a time that doesn't exist in your timezone,
> due to it falling within the hour that was skipped.  Which is why we
> recommend that date-relative commands be executed relative to noon
> rather than midnight, since no (known) timezone makes their daylight
> savings adjustments at noon, and even if the relative operations land at
> 11 am or 1 pm after crossing the boundary, you still end up in the right
> relative day.
> 
> 
>> *$> date --versiondate (GNU coreutils) 8.13Copyright (C) 2011 Free Software
> 
> Newer versions of coreutils come with a 'date --debug' option that give
> you even more insight into failures, including your use case of
> specifying a time that does not exist in your time zone.
> 
> I'm closing this as not a bug, but feel free to add further comments to
> the thread.

For completeness the --debug option outputs:

TZ=America/Los_Angeles date --debug --date="12 Mar 2017 02:05" +%s
date: parsed date part: (Y-M-D) 2017-03-12
date: parsed time part: 02:05:00
date: input timezone: -08:00 (set from TZ="America/Los_Angeles" environment 
value)
date: using specified time as starting value: '02:05:00'
date: error: invalid date/time value:
date:     user provided time: '(Y-M-D) 2017-03-12 02:05:00 TZ=-08:00'
date:        normalized time: '(Y-M-D) 2017-03-12 03:05:00 TZ=-08:00'
date:                                             --
date:      possible reasons:
date:        non-existing due to daylight-saving time;
date:        numeric values overflow;
date:        missing timezone
date: invalid date ‘12 Mar 2017 02:05’

cheers,
Pádraig





reply via email to

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