emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#17161: closed (Bug in date arithmetic of date)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#17161: closed (Bug in date arithmetic of date)
Date: Tue, 01 Apr 2014 16:06:03 +0000

Your message dated Tue, 01 Apr 2014 10:05:27 -0600
with message-id <address@hidden>
and subject line Re: bug#17161: Bug in date arithmetic of date
has caused the debbugs.gnu.org bug report #17161,
regarding Bug in date arithmetic of date
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
17161: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17161
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Bug in date arithmetic of date Date: Tue, 1 Apr 2014 13:30:16 +0200 (CEST) User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
Hi,

There seems to be some weirdness in date arithmetic when dates
include a time stamp (and all provided in ISO formatting):

Correct:

address@hidden:~$ date -d "2014-03-11" +"%Y-%m-%d %H:%M:%S"
2014-03-11 00:00:00

address@hidden:~$ date -d "2014-03-11 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-10 00:00:00

Incorrect:

address@hidden:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d %H:%M:%S"
2014-03-11 15:34:00
address@hidden:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d %H:%M:%S"
2014-03-11 11:34:00
address@hidden:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 13:34:00
address@hidden:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 11:34:00




--- End Message ---
--- Begin Message --- Subject: Re: bug#17161: Bug in date arithmetic of date Date: Tue, 01 Apr 2014 10:05:27 -0600 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
tag 17161 notabug
thanks

On 04/01/2014 05:30 AM, Marc R.J. Brevoort wrote:
> Hi,
> 
> There seems to be some weirdness in date arithmetic when dates
> include a time stamp (and all provided in ISO formatting):

The weirdness is caused by your choice of locale, coupled with your
government's use of daylight savings, and not a bug in 'date'.

See also the FAQ:
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e

> address@hidden:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d %H:%M:%S"
> 2014-03-11 15:34:00
> address@hidden:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d %H:%M:%S"
> 2014-03-11 11:34:00
> address@hidden:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%S"
> 2014-03-12 13:34:00
> address@hidden:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%S"
> 2014-03-12 11:34:00

These examples happen to cross a daylight savings boundary in your
current locale.  If you would amend your example to include time zone
names, you would see the name change, as evidence that the dates listed
are really 2 (or 24) hours apart, even though the wall clock time
appears to be 1 hour off.

You can also force date to operate on --utc, which does not observe
daylight savings, and therefore is immune to these oddities.

As such, I'm closing this as not a bug.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

reply via email to

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