GNU bug report logs - #17161
date: confusing: "TIME -/+NUM" treated as time zone

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: "Marc R.J. Brevoort" <mrjb@HIDDEN>; dated Tue, 1 Apr 2014 15:51:04 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Changed bug title to 'date: confusing: "TIME -/+NUM" treated as time zone' from 'Bug in date arithmetic of date' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 17161 <at> debbugs.gnu.org:


Received: (at 17161) by debbugs.gnu.org; 20 Oct 2018 03:14:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 19 23:14:06 2018
Received: from localhost ([127.0.0.1]:60099 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gDhiI-0003gj-7m
	for submit <at> debbugs.gnu.org; Fri, 19 Oct 2018 23:14:06 -0400
Received: from mail-it1-f178.google.com ([209.85.166.178]:39976)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1gDhiG-0003g3-Ar; Fri, 19 Oct 2018 23:14:04 -0400
Received: by mail-it1-f178.google.com with SMTP id i191-v6so6719355iti.5;
 Fri, 19 Oct 2018 20:14:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=EbkDK2WIqmiMLVXi8hmFgnQq0bFb+U89WQP7elOlxPwIMgVA2bN9W47p3bZpanBIhF
 q3/HTyMh23ibZj6LyQ9+zMFpz5GeqUIr11CpQwoKwt2K//3hzXb0XYwaBbmOCCKbCaJ2
 5H9Papeubja2GBB65PtBhuVCC9gyGzaXxNLa9aVCOuVBrruIQV+wG0DRh+2JnSxr6r63
 pnBTOnPlXZNP27pGVWpQ6JPt/GtpHlcS3hIXnIoFLHgc6jN/xs8cYb/OdsRJV9YHHBkd
 mb8PCCUkGYkutSy2rLMjtq9Qe7e7yUxNuI5ZK23VOpLpIVNYFF8TjG/KKoBn2dXQw7ZG
 VqvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=h67qU0BjWMK4lXm7tyGtsjzn92+T2Y8AfMwG28jiVjU=;
 b=unNLEsZIwU5t8OUf/OGk6Fg9wHTIBwLHgFWXWxJNiQZdXW0asg71nlnSdBYx9lKg7e
 L89PdreYIOvl6QKs94ExtD3uYJJ3W4hsTBc0Gs5gnX/cXiNdwucb7fnHpoqM5F9QnGPc
 /fV1Tjtxvn06uVmqjRBQ7S+UZk2dbCoz4cwJPkPLRcr4WAFW4eMKIo0pG/dMCPvheYdQ
 3zYQRnSzV3j42ujH7h/n6j9kyehDhiMmHFVCm9L1KT/MVkJcaCbW/z+zB9qFie6RF2mh
 jjAguVvDl+KZ/bnpkcctEYjXLI8dKb3w+eeBqwk8IQueAMLb4ihcZmQRllb9KAsNBZOs
 qeAw==
X-Gm-Message-State: ABuFfojkv8sqOYh+m8ejCCnBPmP/4LBlISajitrcqIQA2Pgx7gh+kgKr
 CxVI4d91z1bJetiIp1lb3qaO2RNn+fY=
X-Google-Smtp-Source: ACcGV63ghPFegpHnL32Yz+PyjuEF0pqMk7O6SFO5o26sLWMczKpfCxat4T+XfgoT6SDmDrt016L0Rg==
X-Received: by 2002:a02:7f0e:: with SMTP id
 r14-v6mr26158809jac.124.1540005237833; 
 Fri, 19 Oct 2018 20:13:57 -0700 (PDT)
Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38])
 by smtp.googlemail.com with ESMTPSA id
 82-v6sm1937446ita.17.2018.10.19.20.13.56
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 19 Oct 2018 20:13:56 -0700 (PDT)
Subject: Re: bug#17161: date: confusing: "TIME -/+NUM" treated as time zone
To: Eric Blake <eblake@HIDDEN>, "Marc R.J. Brevoort"
 <mrjb@HIDDEN>, 17161 <at> debbugs.gnu.org
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
 <533BF42F.30600@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <de234f7a-ec3e-13c4-af7d-ca28696dee4d@HIDDEN>
Date: Fri, 19 Oct 2018 21:13:55 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <533BF42F.30600@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 17161
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 17161 wishlist
retitle 17161 date: confusing: "TIME -/+NUM" treated as time zone
stop

(triaging old bugs)

Hello,

On 02/04/14 05:27 AM, Eric Blake wrote:
> On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
>>
>> The more days I subtract, the more hours are added. If this were a time
>> zone issue, the amount of hours added would be constant but the
>> resulting date would not.
> 
> Thanks for persisting.  I was able to reproduce using coreutils.git, and
> I can explain what's happening.  Date is parsing this as:
> 
> "(2014-03-11 12:34:56 -3) (days)"
[...]
> It does indeed seem awkward that date is not parsing this as:
> 
> "(2014-03-11 12:34:56) (-3 days)"
> 
> but fixing that will require tweaks to the getdate.y parser in gnulib.
> I've reopened the bug to track the issue with awkward precedence in the
> parser.

In the mean time, date gained the "--debug" option that makes
diagnosing these issues somewhat easier.

Due to the way the date parser works, the following
rules apply:

1.
Time (HH:MM:SS) followed by a plus/minus character
and a number - ALWAYS parsed as time zone.
The unit that followed (e.g. "days" / "minutes")
are then taken to be of value 1 (e.g. 1 day, 1 minute).

Examples:

   ## This is "Timezone=3, plus one day"
   $ date --debug -d "2014-03-11 12:34:56 +3 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC+03
   date: parsed relative part: +1 day(s)
   date: input timezone: parsed date/time string (+03)
   [...]
   Wed Mar 12 03:34:56 MDT 2014

   ## This is "Timezone=-10, plus one month"
   $ date --debug -d "2014-03-11 12:34:56 -10 months"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: +1 month(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Fri Apr 11 16:34:56 MDT 2014


2.
Time (HH:MM:SS) followed by a number without plus/minus sign,
The number applies to the units.

   ## This is "time, plus 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: +7 seconds
   [...]
   Tue Mar 11 12:35:03 MDT 2014

3.
To subtract units (e.g. three days) without using a minus character
(i.e. forcing rule #2 instead of triggering rule #1), use the word "ago":

   ## This is "time - 7 seconds"
   $ date --debug -d "2014-03-11 12:34:56 7 seconds ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -7 seconds
   [...]
   Tue Mar 11 12:34:49 MDT 2014

   ## This is 3 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 3 days ago"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56
   date: parsed relative part: -3 day(s)
   [...]
   Sat Mar  8 12:34:56 MST 2014

Or use Eric's suggestion of putting the "-3 days"
before the date.

4.
Combining a time zone and a unit value is valid,
e.g.

   ## Timezone = -10, 9 days subtraction
   $ date --debug -d "2014-03-11 12:34:56 -10 -9 days"
   date: parsed date part: (Y-M-D) 2014-03-11
   date: parsed time part: 12:34:56 UTC-10
   date: parsed relative part: -9 day(s)
   date: input timezone: parsed date/time string (-10)
   [...]
   Sun Mar  2 15:34:56 MST 2014

----

As Eric wrote above, modifying the parser could be done in gnulib.
Not so much a technical problem, but very likely to be backward-
incompatible in a way that will break many many existing scripts.

As such, I'm marking this as "wishlist", but keeping it open -
discussion is welcomed to continue by replying to this thread.

regards,
  - assaf





Information forwarded to bug-coreutils@HIDDEN:
bug#17161; Package coreutils. Full text available.
Removed tag(s) notabug. Request was from Bob Proulx <bob@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 17161 <at> debbugs.gnu.org:


Received: (at 17161) by debbugs.gnu.org; 2 Apr 2014 14:48:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 02 10:48:51 2014
Received: from localhost ([127.0.0.1]:33055 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WVMTC-0002UM-O7
	for submit <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:48:51 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:45434)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WVMT9-0002UB-TV
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:48:48 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>)
 id 1WVMT2-0006ZG-Df; Wed, 02 Apr 2014 16:48:45 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>)
 id 1WVMT2-0007LE-77; Wed, 02 Apr 2014 16:48:40 +0200
Date: Wed, 2 Apr 2014 16:48:40 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#17161: closed (Re: bug#17161: Bug in date arithmetic of date)
In-Reply-To: <533BF42F.30600@HIDDEN>
Message-ID: <alpine.DEB.2.00.1404021643230.27572@HIDDEN>
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
 <533BF42F.30600@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SNT-Signature: 2b153a896f0dfa2f28738383baeed568565feb5f
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 17161
Cc: Bug-gnulib <bug-gnulib@HIDDEN>, 17161 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

Hi,

Yes, I've come to the same conclusion (i.e. the numeric value in "+3 days" 
or "-2 days" being treated as time zone). The 8.5 coreutils I tested on 
is in a different time zone so it is possible it doesn't exhibit the same 
behavior because of that, and as such I can't actually tell whether the
behavior is actually resolved in coreutils 8.5.

I confirm that if I type,

mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 0 -1 day" +"%Y-%m-%d
  %H:%M:%S"

(i.e. using "0" as time zone), this gives the expected output,

2014-03-10 12:34:56

Best,
Marc


On Wed, 2 Apr 2014, Eric Blake wrote:

> reopen 17161
> thanks
>
> On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
>> Hello,
>>
>> As a heads-up, the explanation that this is due to time zone+locale
>> doesn't make sense:
>>
>> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -1 day" +"%Y-%m-%d
>> %H:%M:%S"
>> 2014-03-12 13:34:56
>> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -2 days"
>> +"%Y-%m-%d %H:%M:%S"
>> 2014-03-12 14:34:56
>> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -3 days"
>> +"%Y-%m-%d %H:%M:%S"
>> 2014-03-12 15:34:56
>>
>> The more days I subtract, the more hours are added. If this were a time
>> zone issue, the amount of hours added would be constant but the
>> resulting date would not.
>
> Thanks for persisting.  I was able to reproduce using coreutils.git, and
> I can explain what's happening.  Date is parsing this as:
>
> "(2014-03-11 12:34:56 -3) (days)"
>
> that is, -3 is being treated as the timezone, since it occurs next to
> the hour specification; then treating "days" as "+1 day" or "+24 hours".
>
> Watch what happens when you reorder the line to force a different parse:
>
> $ src/date --utc -d "-3 days 2014-03-11 12:34:56" +"%Y-%m-%d %H:%M:%S"
> 2014-03-08 12:34:56
>
> It does indeed seem awkward that date is not parsing this as:
>
> "(2014-03-11 12:34:56) (-3 days)"
>
> but fixing that will require tweaks to the getdate.y parser in gnulib.
> I've reopened the bug to track the issue with awkward precedence in the
> parser.
>
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>




Information forwarded to bug-coreutils@HIDDEN:
bug#17161; Package coreutils. Full text available.
Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.

Message received at 17161 <at> debbugs.gnu.org:


Received: (at 17161) by debbugs.gnu.org; 2 Apr 2014 11:27:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 02 07:27:53 2014
Received: from localhost ([127.0.0.1]:60410 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WVJKi-0003IY-UK
	for submit <at> debbugs.gnu.org; Wed, 02 Apr 2014 07:27:53 -0400
Received: from mx1.redhat.com ([209.132.183.28]:31045)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>) id 1WVJKe-0003II-Mi
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 07:27:51 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s32BRj3T027269
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Wed, 2 Apr 2014 07:27:45 -0400
Received: from [10.3.113.66] (ovpn-113-66.phx2.redhat.com [10.3.113.66])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 s32BRhEX008453; Wed, 2 Apr 2014 07:27:44 -0400
Message-ID: <533BF42F.30600@HIDDEN>
Date: Wed, 02 Apr 2014 05:27:43 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>, 17161 <at> debbugs.gnu.org,
 Bug-gnulib <bug-gnulib@HIDDEN>
Subject: Re: bug#17161: closed (Re: bug#17161: Bug in date arithmetic of date)
References: <533AE3C7.8080502@HIDDEN>	<alpine.DEB.2.00.1404011325170.29333@HIDDEN>	<handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
 <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
In-Reply-To: <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: 17161
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.6 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

reopen 17161
thanks

On 04/02/2014 02:17 AM, Marc R.J. Brevoort wrote:
> Hello,
>=20
> As a heads-up, the explanation that this is due to time zone+locale
> doesn't make sense:
>=20
> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -1 day" +"%Y-%m-%=
d
> %H:%M:%S"
> 2014-03-12 13:34:56
> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -2 days"
> +"%Y-%m-%d %H:%M:%S"
> 2014-03-12 14:34:56
> mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -3 days"
> +"%Y-%m-%d %H:%M:%S"
> 2014-03-12 15:34:56
>=20
> The more days I subtract, the more hours are added. If this were a time=

> zone issue, the amount of hours added would be constant but the
> resulting date would not.

Thanks for persisting.  I was able to reproduce using coreutils.git, and
I can explain what's happening.  Date is parsing this as:

"(2014-03-11 12:34:56 -3) (days)"

that is, -3 is being treated as the timezone, since it occurs next to
the hour specification; then treating "days" as "+1 day" or "+24 hours".

Watch what happens when you reorder the line to force a different parse:

$ src/date --utc -d "-3 days 2014-03-11 12:34:56" +"%Y-%m-%d %H:%M:%S"
2014-03-08 12:34:56

It does indeed seem awkward that date is not parsing this as:

"(2014-03-11 12:34:56) (-3 days)"

but fixing that will require tweaks to the getdate.y parser in gnulib.
I've reopened the bug to track the issue with awkward precedence in the
parser.

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


--l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTO/QvAAoJEKeha0olJ0NqR1UH/jjolWOVgbdOScUoOGwUCRzC
HawkO2f/ALo8aG0ZLvFyy3K8SpwaIUfdSFwgX0da0YgAGr8U9MlOCz1vrd2ykeyM
qPk0IyEUk0syaqZLlHOWGJhqShwmxhYxP5304uQN2f/+6rCenCQxpvXS/SoQTGvd
T7W/SxTd4LbOweN27BPzB6NDTVHk0GgXLyXtaqrvAQ1/gqvbn1fJ1WnlOzft4xKX
2sy/0c5l51Tz8urtab5u2hl60SEcgK+Bmp0FpF8C8O348/I9zQJMDDTAIJ5yiY+N
RubFiNutkVfaues5GxsQW57E87HIQgd6S1t0kk5rSZGG29ePhLKUKxdWt+MloxE=
=xj30
-----END PGP SIGNATURE-----

--l1AgSn02A86QqmE6HEJw1wO7jM4JbjXg2--




Information forwarded to bug-coreutils@HIDDEN:
bug#17161; Package coreutils. Full text available.

Message received at 17161 <at> debbugs.gnu.org:


Received: (at 17161) by debbugs.gnu.org; 2 Apr 2014 08:18:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 02 04:18:09 2014
Received: from localhost ([127.0.0.1]:60337 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WVGN5-0006j0-QS
	for submit <at> debbugs.gnu.org; Wed, 02 Apr 2014 04:18:08 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:51801)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WVGN0-0006ia-9V
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 04:18:06 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WVGMt-00032t-V4
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:18:00 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WVGMt-0003ur-OY
 for 17161 <at> debbugs.gnu.org; Wed, 02 Apr 2014 10:17:55 +0200
Date: Wed, 2 Apr 2014 10:17:55 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
To: 17161 <at> debbugs.gnu.org
Subject: Re: bug#17161: closed (Re: bug#17161: Bug in date arithmetic of date)
In-Reply-To: <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
Message-ID: <alpine.DEB.2.00.1404021014300.14439@HIDDEN>
References: <533AE3C7.8080502@HIDDEN>
 <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.D17161.13963683355115.notifdone <at> debbugs.gnu.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SNT-Signature: d6a583d75c59b3983c75df41cc0d08d84334eb49
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 17161
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

Hello,

As a heads-up, the explanation that this is due to time zone+locale doesn't make sense:

mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -1 day" +"%Y-%m-%d 
%H:%M:%S"
2014-03-12 13:34:56
mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -2 days" +"%Y-%m-%d 
%H:%M:%S"
2014-03-12 14:34:56
mrjb@THE-D-MRJB:~$ date --utc -d "2014-03-11 12:34:56 -3 days" +"%Y-%m-%d 
%H:%M:%S"
2014-03-12 15:34:56

The more days I subtract, the more hours are added. If this were a time 
zone issue, the amount of hours added would be constant but the 
resulting date would not.

Best,
Marc

On Tue, 1 Apr 2014, GNU bug Tracking System wrote:

> Your bug report
>
> #17161: Bug in date arithmetic of date
>
> which was filed against the coreutils package, has been closed.
>
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 17161 <at> debbugs.gnu.org.
>
> -- 
> 17161: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17161
> GNU Bug Tracking System
> Contact help-debbugs@HIDDEN with problems
>




Information forwarded to bug-coreutils@HIDDEN:
bug#17161; Package coreutils. Full text available.

Message received at 17161-done <at> debbugs.gnu.org:


Received: (at 17161-done) by debbugs.gnu.org; 1 Apr 2014 16:05:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 01 12:05:35 2014
Received: from localhost ([127.0.0.1]:59565 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV1Bu-0001KO-AO
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:05:35 -0400
Received: from mx1.redhat.com ([209.132.183.28]:63910)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>)
 id 1WV1Bq-0001KA-7Y; Tue, 01 Apr 2014 12:05:32 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s31G5STX016624
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Tue, 1 Apr 2014 12:05:28 -0400
Received: from [10.3.113.179] (ovpn-113-179.phx2.redhat.com [10.3.113.179])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 s31G5Sdb019750; Tue, 1 Apr 2014 12:05:28 -0400
Message-ID: <533AE3C7.8080502@HIDDEN>
Date: Tue, 01 Apr 2014 10:05:27 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version: 1.0
To: "Marc R.J. Brevoort" <mrjb@HIDDEN>, 17161-done <at> debbugs.gnu.org
Subject: Re: bug#17161: Bug in date arithmetic of date
References: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
In-Reply-To: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
X-Enigmail-Version: 1.6
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="KxhlDcLjA11FDMJb87wBrbhia329BTCW8"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: 17161-done
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.6 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

tag 17161 notabug
thanks

On 04/01/2014 05:30 AM, Marc R.J. Brevoort wrote:
> Hi,
>=20
> 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-co=
mmand-is-not-working-right_002e

> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 15:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d %H:%M=
:%S"
> 2014-03-11 11:34:00
> mrjb@THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%=
S"
> 2014-03-12 13:34:00
> mrjb@THE-D-MRJB:~$ 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.

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


--KxhlDcLjA11FDMJb87wBrbhia329BTCW8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJTOuPHAAoJEKeha0olJ0Nqw7AIAK5OcxxcEVA5u04FpnvlHhLN
cfrI3cpPUCV2LIafrAGh+6Tbu8blEa0YC9NrsfJEOKgLMab1JRimcFKfsLXlIBCJ
4bBd4peiMohVN4teUMW1YgOdoMWLRT4pa7VAHt8BKOG5IIQ5uhqNvThq1N1SvxqW
gTHlG++h6W72y+xsIcAosK1B/dh27q8qeuVyvx9l2m8YZ7yY6CV54isWOLog6ChO
EQzZcDfEXjDf565snyhtgdVTT2FxppzYUrMv433T3kdrPRziFY6bNeg9DN/c+bfR
630TAHXfZAFdb2Az4kVBeJN74fD6aB85v2gkcWwuMi0aqGir3u6XlV84Bo/bJ2s=
=41YW
-----END PGP SIGNATURE-----

--KxhlDcLjA11FDMJb87wBrbhia329BTCW8--




Notification sent to "Marc R.J. Brevoort" <mrjb@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Eric Blake <eblake@HIDDEN>:
You have taken responsibility. Full text available.
Added tag(s) notabug. Request was from Eric Blake <eblake@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 17161 <at> debbugs.gnu.org:


Received: (at 17161) by debbugs.gnu.org; 1 Apr 2014 16:02:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 01 12:02:14 2014
Received: from localhost ([127.0.0.1]:59561 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV18b-0001Eu-4X
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:02:13 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:55182)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WV18U-0001Do-0W
 for 17161 <at> debbugs.gnu.org; Tue, 01 Apr 2014 12:02:07 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WV18Q-0001gn-MQ
 for 17161 <at> debbugs.gnu.org; Tue, 01 Apr 2014 18:02:00 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WV18Q-0007iG-FN
 for 17161 <at> debbugs.gnu.org; Tue, 01 Apr 2014 18:01:58 +0200
Date: Tue, 1 Apr 2014 18:01:58 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
To: 17161 <at> debbugs.gnu.org
Subject: Re: bug#17161: Acknowledgement (Bug in date arithmetic of date)
In-Reply-To: <handler.17161.B.13963674413468.ack <at> debbugs.gnu.org>
Message-ID: <alpine.DEB.2.00.1404011759430.29039@HIDDEN>
References: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
 <handler.17161.B.13963674413468.ack <at> debbugs.gnu.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SNT-Signature: 4f5d08f46eba6dd222b82276e28a5254388c0835
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 17161
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

Additional information -

The behaviour occurs in GNU coreutils 7.4. Version 8.5 appears to work 
correctly so this may be a dupe.




Information forwarded to bug-coreutils@HIDDEN:
bug#17161; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Apr 2014 15:50:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 01 11:50:40 2014
Received: from localhost ([127.0.0.1]:59538 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WV0xU-0000ts-77
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 11:50:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57154)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mrjb@HIDDEN>) id 1WUwua-0001Hw-P3
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007ng-M5
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:24 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38652)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuQ-0007nc-Ja
 for submit <at> debbugs.gnu.org; Tue, 01 Apr 2014 07:31:14 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58673)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuJ-0003Np-4L
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007gm-Lm
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:31:07 -0400
Received: from mx1.snt.utwente.nl ([130.89.149.33]:38073)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mrjb@HIDDEN>) id 1WUwuB-0007SO-Ga
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 07:30:59 -0400
Received: from ringbreak.dnd.utwente.nl ([130.89.148.32] ident=Debian-exim)
 by mx1.snt.utwente.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.72) (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0004hW-Jj
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:21 +0200
Received: from mrjb (helo=localhost)
 by ringbreak.dnd.utwente.nl with local-esmtp (Exim 4.72)
 (envelope-from <mrjb@HIDDEN>) id 1WUwtU-0007ml-3W
 for bug-coreutils@HIDDEN; Tue, 01 Apr 2014 13:30:16 +0200
Date: Tue, 1 Apr 2014 13:30:16 +0200 (CEST)
From: "Marc R.J. Brevoort" <mrjb@HIDDEN>
To: bug-coreutils@HIDDEN
Subject: Bug in date arithmetic of date
Message-ID: <alpine.DEB.2.00.1404011325170.29333@HIDDEN>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-SNT-Signature: f6dda9c21ec6c20fb742f2ad25af7f8a099a7ad2
X-SNT-Spam-Score: -1.6
X-SNT-Spam-Score-Bar: -
X-SNT-Spam-Report: Content analysis details:   (-1.6 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -0.0 T_RP_MATCHES_RCVD      Envelope sender domain matches handover relay
 domain
 -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 01 Apr 2014 11:50:38 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hi,

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

Correct:

mrjb@THE-D-MRJB:~$ date -d "2014-03-11" +"%Y-%m-%d %H:%M:%S"
2014-03-11 00:00:00

mrjb@THE-D-MRJB:~$ date -d "2014-03-11 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-10 00:00:00

Incorrect:

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





Acknowledgement sent to "Marc R.J. Brevoort" <mrjb@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#17161; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.