Re: [Perl-unix-users] How to parse a date string and convert it intomm/dd/yyyy format
by Matt Schneider other posts by this author
Jan 5 2007 12:19PM messages near this date
[Perl-unix-users] Gs pdf to jpeg text problem
|
Re: [Perl-unix-users] How to parse a date string and convert it intomm/dd/yyyy format
You could try something like this:
$data = '760434|c|061230';
($date) = $data =~ m/^.\|(\d+)/;
$date =~ s%(\d\d)(\d\d)(\d\d)%$2/$3/20$1%;
Matt
-----Original Message-----
From: perl-unix-users-bounces@[...].com
[mailto:perl-unix-users-bounces@[...].com] On Behalf Of
AITHA, BHEEMSEN (SBCSI)
Sent: Friday, January 05, 2007 11:57 AM
To: $Bill Luebkert; perl-unix-users@activestate.com;
perl-unix-users@[...].com
Subject: [Perl-unix-users] How to parse a date string and convert it
intomm/dd/yyyy format
Hi,
I have a file with the following as the first line.
760434|c|061230
I need to parse this line and read 061230 into a variable and then try
to convert that string into the date in format mm/dd/yyyy. Report any
error while converting the string.
Any sample code would be a great help.
I do not want to use Date::Manip module.
Thanks for any help.
-Bheem
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Matt Schneider
Andy Bach
Andy Bach
Deane Rothenmaier
Deane Rothenmaier
|