GNU bug report logs -
#23270
Bug in 'date' command
Previous Next
Reported by: Maarten <maarten <at> mastbroek.nl>
Date: Mon, 11 Apr 2016 17:07:01 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.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 23270 in the body.
You can then email your comments to 23270 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#23270
; Package
coreutils
.
(Mon, 11 Apr 2016 17:07:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Maarten <maarten <at> mastbroek.nl>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 11 Apr 2016 17:07:01 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)]
Hello,
I recently discovered a bug, or at least unexpected behavior, about the ‘date’ command which I want to report. The bug is related to the moment of ‘daylight saving time’ (summertime / wintertime)
On Monday the 28st of march at 0.15 I run an automated script with the command:
# date -d yesterday +%d-%m-%Y
The return of that command was 26-03-2016 where I expected 27-03-2016. (2 days before, where I expected only 1 day before)
My only explanation is that the command is run the day after 27-3-2016, the day that the our region switched from summertime to wintertime. At 2.00 the clock is forwarded to 3.00 so the day is only 23 hours long. When I request a ‘yesterday at 28-03-20160.15 the request is about 24 hours before. The answer is 26-03-2016 at 23.15.
Anyway, a ‘date -d yesterday’ should return 1 day before, not 2 days before. In my case, as a result of it, an automated shell script went wrong.
Please, can you fix this ‘daylight saving time’ related bug?
More info:
Timezone: Amsterdam, europe
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
# date --version
date (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie.
Many thanks! If you need further information, please let me know.
Best regards,
Maarten Mastbroek
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#23270
; Package
coreutils
.
(Mon, 11 Apr 2016 18:12:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 23270 <at> debbugs.gnu.org (full text, mbox):
tag 23270 notabug
close 23270
thanks
Hello Maarten Mastbroek,
On 04/11/2016 12:36 PM, Maarten wrote:
> I recently discovered a bug, or at least unexpected behavior, about
> the ‘date’ command which I want to report. The bug is related to the
> moment of ‘daylight saving time’ (summertime / wintertime)
This is not a bug (perhaps indeed unexpected behavior).
It is explained in the Coreutils FAQ:
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e
Your diagnosis is correct:
> [...] When I request a ‘yesterday' request is about 24 hours before.
In GNU 'date', the relative period of 'yesterday' is defined exactly as 24 hours,
regardless of daylight saving time.
The recommended way to perform all relative day calculations is to specify 12:00pm,
so that adding/subtracting 24-hours avoids DST issues.
Example:
date -d "12:00 yesterday" +%d-%m-%Y
(similarly, when calculating relatives months, it is recommended to specify the 15th of the month, to avoid leap-years issues.)
As such I'm closing this bug, but discussion can continue by replying to this thread.
regards,
- assaf
Added tag(s) notabug.
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Oct 2018 22:14:03 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
23270 <at> debbugs.gnu.org and Maarten <maarten <at> mastbroek.nl>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Oct 2018 22:14:03 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
.
(Sun, 25 Nov 2018 12:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 203 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.