GNU bug report logs -
#26293
GNU date program
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26293 in the body.
You can then email your comments to 26293 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#26293
; Package
coreutils
.
(Wed, 29 Mar 2017 07:48:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Dean Gibson AE7Q <wa7dem.stuff <at> ae7q.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 29 Mar 2017 07:48: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)]
Consider: "date -d '2017-03-28 17:12:34 + 3 hours'"
In "date (coreutils) 5.2.1 (March 2004)" it gives "Tue Mar 28 20:12:34
PDT 2017".
In "GNU coreutils 8.22 February 2016)" it gives "Tue Mar 28 08:12:34 PDT
2017".
Both servers use /etc/localtime -> /usr/share/zoneinfo/PST8PDT
If I insert "PDT" in the original string after the time, it works on
both servers. Unfortunately, since the servers run in an area that is
subject to daylight savings time part of the year, hard coding the 'PDT'
zone in the script it was in, is not appropriate.
On both servers, "date -d '2017-03-28 17:12:34 3 hours ago'" works. Is
there a "3 hours ahead"-type phrase???
I have settled on "... 21 hours ago tomorrow", which works on both servers.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#26293
; Package
coreutils
.
(Wed, 29 Mar 2017 14:19:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 26293 <at> debbugs.gnu.org (full text, mbox):
tags 26293 notabug
close 26293
stop
Hello,
> On Mar 28, 2017, at 22:26, Dean Gibson AE7Q <wa7dem.stuff <at> ae7q.com> wrote:
>
> Consider: "date -d '2017-03-28 17:12:34 + 3 hours'"
Due to the way date strings are parsed, the "+3" part is used as the input time zone (+03:00) and then the "hours" part is taken as adding one hour.
> If I insert "PDT" in the original string after the time, it works on both servers.
Yes, once the parser sees an explicit timezone (PDT), it deduces the rest is a relative time ("+3 hours").
> On both servers, "date -d '2017-03-28 17:12:34 3 hours ago'" works. Is there a "3 hours ahead"-type phrase???
Yes, simply writing "3 hours" means "3 hours ahead".
Additionally,
The 'date' command in coreutils 8.27 has a new "--debug" option that displays
details about the parsed string, helping in diagnosing such issues.
Compare the following examples:
"+3" treated as timezone:
$ date --debug -d '2017-03-28 17:12:34 + 3 hours'
date: parsed date part: (Y-M-D) 2017-03-28
date: parsed time part: 17:12:34 TZ=+03:00
date: parsed relative part: +1 hour(s)
date: input timezone: +03:00 (set from parsed date/time string)
...
Adding "PDT" works, but not the desired solution:
$ date --debug -d '2017-03-28 17:12:34 PDT + 3 hours'
date: parsed date part: (Y-M-D) 2017-03-28
date: parsed time part: 17:12:34
date: parsed zone part: TZ=-07:00
date: parsed relative part: +3 hour(s)
date: input timezone: -07:00 (set from parsed date/time string)
...
"3 hours" works:
$ date --debug -d '2017-03-28 17:12:34 3 hours'
date: parsed date part: (Y-M-D) 2017-03-28
date: parsed time part: 17:12:34
date: parsed relative part: +3 hour(s)
...
I'm marking this as "not-a-bug", but the 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
.
(Wed, 29 Mar 2017 14:19:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
26293 <at> debbugs.gnu.org and Dean Gibson AE7Q <wa7dem.stuff <at> ae7q.com>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 29 Mar 2017 14:19: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
.
(Thu, 27 Apr 2017 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 59 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.