[Top][All Lists]

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

Re: date -d20060229 gives: "invalid date"

From: Steve Cousins
Subject: Re: date -d20060229 gives: "invalid date"
Date: Tue, 29 Aug 2006 12:08:29 -0400
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050512 Red Hat/1.7.8-

Paul Eggert wrote:

Steve Cousins <address@hidden> writes:

date Versions 5.96 and 5.97 (at least) have a bug when passing dates
that are greater than the actual number of days in a month.  Previous
versions (most of the machines seem to have 5.2.1) would convert the
date to a correct date.

The change was advertised as a "new feature" in NEWS:

   Dates like `January 32' with out-of-range components are now rejected.
Hi Paul,

Thanks for the reply.

Don't I love new "features" like this?! What is the purpose of this? I guess I'll look it up. ... It looks like there was no discussion. Just a quick statement. How is it more useful to report an error rather than doing a meaningful conversion?

   date -d"20060201 - 1 day"

does not work.  It reports Feb 2.

Try this:

  date -u -d"2006-02-01 -1 day"

Well, by putting in the hyphens it does work. The -u (at least in this example) doesn't seem to do anything. However, doing:

date.5.96 -u -d"20060201 -1 day"

   date.5.96: invalid date `20060201 -1 day'


   date.5.2.1 -u -d"20060201 - 1 day"


   Thu Feb  2 00:00:00 UTC 2006

Which is wrong but it at least tries to deal with dates in the form YYYYMMDD. Is this a bug or a feature?


reply via email to

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