If it's just a date you want to convert, why not use the functions already 
provided?

  $output = date('d-m-y', strtotime($input));

miguel

On Wed, 29 May 2002, Martin Towell wrote:
> 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