> What I really need is to re-order the string that a user inputs, say,
> 21/04/2004, so that it becomes 04/21/2004 so I can use strtotime.

I use preg_match() (http://www.php.net/manual/de/function.preg-match.php):

$dateuk = '21/04/2004';
preg_match("/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})/", $dateuk, $m='');
$dateus = "$m[2]/$m[1]/$m[3]";

[0-9]{1,2} matches one or two numbers from 0 to 9
\/ matches /
(...) the first brackets-pair will go to $m[1] the second to $m[2] ...

g. martin luethi

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

Reply via email to