in reply to Re: DateTime normalize
in thread DateTime normalize
Correct. now creates a new object and initialises it to the current time.
my $dt = DateTime->now(); my $dt = DateTime->now( time_zone => 'local' );
The OP appears to be trying to format the timestamp into a string. For this, he has a number of options.
He could construct the formatted timestamp himself. There are getters to get each individual components, there are getters that return the date in a couple of simple formats, and there's a getter that returns the time.
He could use $dt->strftime, which returns the contained date and/or time in just about any format you can imagine.
There's also the option of using a (parsing and) formatting helper module. These are typically named DateTime::Format::<format> (e.g. DateTime::Format::Atom).
|
|---|