Re: Date format conversion
- From: "Mothra" <mothra@xxxxxxxxxxxxxxxx>
- Date: Tue, 30 May 2006 16:52:47 -0700
Robert wrote:
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
.
- Follow-Ups:
- Re: Date format conversion
- From: Robert
- Re: Date format conversion
- References:
- Date format conversion
- From: Robert
- Date format conversion
- Prev by Date: How to have a Perl script emulate a keystroke to another application
- Next by Date: Re: Convert string into incremental date
- Previous by thread: Re: Date format conversion
- Next by thread: Re: Date format conversion
- Index(es):
Relevant Pages
|