in reply to Re: Date::Format handling of ISO week number format
in thread Date::Format handling of ISO week number format
Because when the date falls in the first week of the year or the last week of the year, that'll be wrong about half the time. For instance,
Actually, I thought it would print "2007-W01" ... I guess D::F's %W is broken to go along with its lack of UnixDate-equivalent-%L. At least it works better than I thought, I suppose ... but of course, according to ISO 8601, 2007-W52 is still wrong.use strict; use warnings; use Date::Manip qw<UnixDate>; use Date::Parse qw<str2time>; use Date::Format qw<time2str>; print UnixDate("12/31/2007", "%L-W%W"), "\n"; # prints "200 +8-W01" print time2str("%Y-W%W", str2time("12/31/2007")), "\n"; # prints "200 +7-W52" (!!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Date::Format handling of ISO week number format
by grinder (Bishop) on Jan 16, 2008 at 11:50 UTC | |
by Oberon (Monk) on Jan 16, 2008 at 23:48 UTC |