Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Types::DateTime, DateTimeUTC->plus_coercions( Format['ISO8601'] ), output format override question

by ikegami (Patriarch)
on Dec 24, 2019 at 14:39 UTC ( [id://11110591]=note: print w/replies, xml ) Need Help??


in reply to Types::DateTime, DateTimeUTC->plus_coercions( Format['ISO8601'] ), output format override question

$cowtime->timestamp is a DateTime object, so you could use the following:

$cowtime->timestamp->strftime("%Y-%m-%dT%H:%M:%S.%9N%z") =~ s/(?=..\z) +/:/sr

I'm not aware of any DateTime::Format::* class that would produce the format you want. If there was you could set it as the default format (used for stringification) using the following:

use DateTime::Format::Foo qw( ); my $format = DateTime::Format::Foo->new(...); $cowtime->timestamp->set_formatter($format);
  • Comment on Re: Types::DateTime, DateTimeUTC->plus_coercions( Format['ISO8601'] ), output format override question
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11110591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-26 07:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found