in reply to Regex to parse a date

my $dt = "2003 % 05 % 1720:55:23"; my $date = sprintf "%d-%02d-%02d", $dt =~ /(\d+) % (\d+) % (\d{2})/; print "date - $date\n"; __output__ date - 2003-05-17
That seems to do the trick, but you might also want to check out some of the Date and Time modules for more advanced datetime munging.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Regex to parse a date
by MD (Initiate) on May 19, 2003 at 10:18 UTC
    Great...thanks Broquaint! I only posted the question 15mins ago and 3 solutions already!!

    I'll check out Date::Manip...thanks..MD:-)