Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'd be grateful for any pointers in converting this date.use strict; use warnings; use DateTime::Format::Builder; my $date = "Thu, 7 Aug 2008 08:35:36 +01:00"; $date =~ s/Thu\, //; $date =~ s/\+01:00$//; $date =~ s/Aug/08/; my $parser = DateTime::Format::Builder->new(); $parser = DateTime::Format::Builder->create_parser( regex => qr/^(\d\d)(\d\d)(\d\d\d\d)T(\d\d)(\d\d)(\d\d)$/, params => [ qw( day month year hour minute second ) ], ); my $dt = $parser->parse_datetime($date); print $parser->format_datetime($dt);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DateTime conversion
by davorg (Chancellor) on Aug 07, 2008 at 10:49 UTC | |
by dHarry (Abbot) on Aug 07, 2008 at 11:35 UTC | |
by davorg (Chancellor) on Aug 07, 2008 at 11:53 UTC | |
|
Re: DateTime conversion
by wfsp (Abbot) on Aug 07, 2008 at 11:28 UTC | |
|
Re: DateTime conversion
by Bloodnok (Vicar) on Aug 07, 2008 at 10:19 UTC | |
by FunkyMonk (Bishop) on Aug 07, 2008 at 11:31 UTC | |
by davorg (Chancellor) on Aug 07, 2008 at 10:24 UTC |