ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-unix-users
perl-unix-users
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved