chansen / p5-time-moment

Time::Moment represents an exact moment in time.
32 stars 8 forks source link

Add support for dates from MySQL and other databases... #10

Closed ghost closed 9 years ago

ghost commented 9 years ago

It will be nice if you can add support for other datetime formats...

No I can do it with something like this:

$dt = Time::Moment->from_string('2014-12-04 12:13:14' . 'Z', lenient => 1);

$dt2 = Time::Moment->from_string('2014-12-04' . 'T00Z', lenient => 1);

chansen commented 9 years ago

I don't think I would add support for this within Time::Moment, since an instance of Time::Moment represent a instant with an offset from UTC. So if you know your timestamp or date is in UTC, appending Z or T00Z is reasonable IMHO.