Date format conversion

R

Robert

Hello,

I want to convert a date string "2006-05-30T07:01:00Z" in to the
format "Tue, 30 May 2006 11:48:00 GMT". How to do this? A short &
simple solution would be great!

Thanks for your help,

Robert
 
M

Mothra

Robert said:
Hello,

I want to convert a date string "2006-05-30T07:01:00Z" in to the
format "Tue, 30 May 2006 11:48:00 GMT". How to do this? A short &
simple solution would be great!

Thanks for your help,

Robert

This should help get you started

use strict;
use warnings;
use DateTime;
use DateTime::Format::Strptime;
use DateTime::Format::ISO8601;

my $Strp = new DateTime::Format::Strptime(
pattern => '%a, %d %b %Y %H:%M:%S %Z'
);

print $Strp->format_datetime(
DateTime::Format::ISO8601->parse_datetime('2006-05-30T07:01:00Z') );

D:\scripts>me.pl
Tue, 30 May 2006 07:01:00 UTC
D:\scripts>

Note:
GMT notation is outdated and should no longer be used

Hope this helps

Mothra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top