I have a string which is a date - eg "01-JUL-02"
I want to convert the month bit to it's corresponding number, so the above
would become "01-07-02"
Can this easily be done using a regex?

Otherwise I was thinking of this:

$mon = array("JAN"=>"01", "FEB"=>"02", "MAR"=>"03", etc...);
list($x, $y, $z) = explode("-", $date);
$date = $x."-".$mon[$y]."-".$z;

A bit dodgy, but if I have to....

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to