[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [GT] Q re DateTime and Date format too
ras,
with respect to monthly data, the pod says:
This module treat dates describing a month. They have the following
format :
YYYY-MM
But the code requires YYYY/MM
In fact, as you mention below, almost all date formats require "-" as
separator, only for the month format the code uses "/". It seems an
inconsistency that should be removed.
I believe there is no need to differentiate the dates as we already
indicate the timeframe as a parameter to the scripts. So there is no
problem having the format YYYY-xx to denote either weeks (if timeframe
is week) or months (if timeframe is months). It is much worse to have an
error.
I think the whole date parsing is a problem as you also state:
1. It should be possible to use a date 2008-04-01 in weekly timeframe
and mean week 14, rather than week 4. In other words, allow all date
formats in all timeframes and do the right thing.
2. It would be even nicer to allow relative dates as in Date::Manip ("2
weeks ago").
I might look at that later...
But in the meantime, I think it is definitely wrong to have the
inconsistency in the monthly format, in particular, as "2004-04-01"
parses correctly in monthly timeframe if we use "-" as the separator,
but currently fails.
Th.
> -----Original Message-----
> From: Robert A. Schmied [mailto:ras
AT
acm.org]
> Sent: Friday, March 21, 2008 11:49 AM
> To: devel
AT
geniustrader.org
> Subject: Re: [GT] Q re DateTime and Date format too
>
> > The code in DateTime::Month, however, implements "/" as separator:
> > YYYY/MM.
> >
> > I believe the latter is a mistake. Please advise whether anybody
relies
> > on this inconsistency. If I don't hear anything back, I shall fix
this
> > to be consistent and use YYYY-MM as the format.
> >
>
> my understanding, and it may be fully (or just partially) in error,
> is that date string formats vary depending on the timeframe.
>
> timeframe date string
> sub day YYYY-MM-DD HH:MM:SS
> day YYYY-MM-DD (time optional)
> week YYYY-ww where ww 01 to 53 (leading zero required iirc)
> month YYYY/MM
> year YYYY
>
> i don't believe the YYYY/MM is a mistake, it seems to accept and
> do correct things with that string. i believe the mistake is not
> disambiguating YYYY-MM-DD from YYYY-ww and not emphasizing it
> in the documentation.
>
> in a week time frame YYYY-MM-DD is accepted, but is used incorrectly,
> as MM isn't the same as ww. try a weekly graphic.pl with start
> at 2007-06-01 and end at 2007-12-04 -- notice how the graph starts
> on the 6th week of 2007 and ends on the 12th week.
>