[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: date issues with YYYYMMDD/YYMMDD date format and relative offset
From: |
Jim Meyering |
Subject: |
Re: date issues with YYYYMMDD/YYMMDD date format and relative offset |
Date: |
Fri, 16 Nov 2007 21:06:08 +0100 |
Ondřej Vašík <address@hidden> wrote:
> date command has some troubles with YYYYMMDD date format.
> When you try 'date -d "20050101 +1 day"' (or whatever
> relative offset), you will get invalid date because
> of conflicts in translation tables. Nearly same command
> date -d "20050101 UTC +1 day" is working correctly with
> current version of coreutils.
>
> Solution is easy - to add hybrid date/time/relative option
> to getdate.y as I did in attached patch. Should be
> harmless for the rest of date formats. I know that
> this YYYYMMDD format is not recommended in any man/info
> pages, but is still considered valid, so should be
> handled correctly. Same is corrected for time
> hhmm/hh format.
> (for details you can check redhat bugzilla #377781)
Hi Ondřej,
Thanks for the patch.
However, there's a simple work-around: simply to drop the "+", e.g.,
$ date -d '20050101 1 day'
Sun Jan 2 00:00:00 CST 2005
In any case, I couldn't accept that patch, because it would allow
the YYYYMMDD syntax anywhere get_date currently accepts a "rel"
(relative offset) non-terminal.