GNU bug report logs - #6897
date -d '1991-04-14 +1 day' fails

Previous Next

Package: coreutils;

Reported by: 李嘉鹏 <lijpbasin <at> 126.com>

Date: Sun, 22 Aug 2010 19:33:02 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> CS.UCLA.EDU>
To: Alan Curry <pacman-cu <at> kosh.dhis.org>
Cc: 6897 <at> debbugs.gnu.org, 李嘉鹏 <lijpbasin <at> 126.com>
Subject: bug#6897: date -d '1991-04-14 +1 day' fails
Date: Mon, 23 Aug 2010 09:01:39 -0700
On 08/22/10 18:09, Alan Curry wrote:
> There might be less occurrences of this misunderstanding if we could teach
> date that -d 4/14/1991 is not actually a request for 4/14/1991 00:00:00, but
> "any time that existed during the day 4/14/1991", or perhaps a more specific
> "the first second of 4/14/1991".
> 
> Has that been considered and rejected already, or is it just waiting for
> someone to implement it?

As far as I know nobody has ever suggested that, and it is a reasonable suggestion.
However, it would not fix the problem in general, since in some cases there
is no "first second of date X", even when X is valid.  For example:

$ TZ=Pacific/Kwajalein date -d 1993-08-20
date: invalid date `1993-08-20'

There was no time during the day 1993-08-20, because at midnight Kwajalein
moved the clocks ahead by 24 hours.

Perhaps the semantics could be "the first second whose time stamp is on
or after 1993-08-20 00:00:00", though then we'd have to deal with bug reports
from people on Kwajalein saying "wait a minute: I asked for August 20, but
it gave me August 21!".

Aren't dates fun?






This bug report was last modified 14 years and 275 days ago.

Previous Next


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