in reply to Convert US dates to mySQL dates
Well, I don't know exactly what you are looking to do to "validate date", but the conversion is pretty straight forward:
my $date = "12-02-2000"; (my $out = $date) =~ s/(\d{1,2})-(\d{1,2})-(\d{2,4})/$3\-$1\-$2/;
Printing $out returns 2000-12-02. Sure, you can shorten it some, or use different syntax, but this should handle most of these date conversions.
Of course, the standard "use strict" and "-w" recommendations apply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Convert US dates to mySQL dates
by diarmuid (Beadle) on May 01, 2001 at 15:44 UTC |