| Author |
Date format conversion
|
|
| Robert 2006-05-30, 8:01 am |
| 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
| |
| bugbear 2006-05-30, 8:01 am |
| 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!
Your input looks looks like ISO 8601
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
Looking for a 8601 parser will be half
your answer.
BugBear
| |
| David Squire 2006-05-30, 8:01 am |
| 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!
>
Use the Time::Format module:
http://search.cpan.org/~roode/Time-...-1.02/Format.pm
CPAN is your friend.
DS
| |
| Mothra 2006-05-30, 7:04 pm |
| 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
| |
| Robert 2006-05-31, 4:01 am |
| Thank you for your answer!
Robert
| |
| David Squire 2006-05-31, 8:05 am |
| Robert wrote:
> Thank you for your answer!
>
> Robert
>
Thank who for what answer? Please quote context and include
attribution(s) when you reply.
DS
|
|
|
|