[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 14:42:37 -0400 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
Paul Eggert wrote:
Steve Cousins <address@hidden> writes:
Don't I love new "features" like this?! What is the purpose of this?
Don't you just love date string parsing? It's a subtle area, full of
surprises.
Hi Paul,
Yeah. I thought I had it worked out years ago. Or at least the small
part that I've needed. You're just trying to add some variety to my
life I see.
How is it more useful to report an error rather than doing a
meaningful conversion?
Because there's no such thing as a "meaningful conversion" that makes
everyone happy if you have an invalid date. Invalid dates are
inherently ambiguous. Is "Feb 29, 2006" actually Feb 28 or Mar 1? Is
02:30 on April 2, 2006 actually 03:30 or 01:30? You can come up with
good arguments either way. We warn users about the ambiguities by
saying "no, you must write something like '2004-02-29 +2 years' if you
want to add two years to a date". This avoids the ambiguity for "Feb
29, 2006".
Why can't everything be done _my_ way? ;^)
Is this a bug or a feature?
When it comes to parsing long digit strings, everything is a bug. (:-)
Use the hyphens; they are your friends.
Except for when all of your scripts (for the last six years) use
YYYYMMDD format. :~o I'll just use the old and faithful 5.2.1.
Thanks,
Steve
--
______________________________________________________________________
Steve Cousins, Ocean Modeling Group Email: address@hidden
Marine Sciences, 452 Aubert Hall http://rocky.umeoce.maine.edu
Univ. of Maine, Orono, ME 04469 Phone: (207) 581-4302