On 2001-05-05 20:58:11, [EMAIL PROTECTED] wrote:
>
> which date format are you recommending that we use as the "common
> language"?
datetime := date "T" time
date := year month day
year := 4*( "0" .. "9" )
month := "01" .. "12"
day := "01" .. "31"
time := hour minute second *( zone )
hour := "00" .. "23" # midnight is 00:00, not 24:00.
minute := "00" .. "59"
second := "00" .. "59" *( "." 1*( "0".."9" ) )
zone := "Z" | ( ("+" | "-" ) hour minute )
Comments?
Now is about 20010506T073000+0530 localtime, which is 20010506T020000Z.
Or, if you want millisecond precision, 20010506T073000.000+0530.
This representation is (as far as I can see; please tell me if I am
missing something) ISO 8601 compliant, and backwards compatible with
ICal except for fractional seconds and offset timezones, both of which
are optional. I've also almost finished a parser for it.
I was going to write Date::ISO, but I see you already did. :-)
> > > > my $mdisco = Date::Mayan->new($disco); [...]
>
> So if we create a new object in the way that you suggest, then we only
> have to require that they supply one common method
Exactly, which means that you can give new() any object which knows how
to date itself:
$time = $obj;
if (ref $obj) {
if ($obj->can('foo')) { $time = $obj->foo; }
else { croak "Your object doesn't know how to foo."; }
}
$self->_parse($time);
- ams