On Wed, Jul 10, 2002 at 12:25:08PM -0500, Rw wrote: > > "01-02-2003" > > Is there a handy function to convert that to other ways of expressing the > date such as: > > "01/02/03"
$temp = preg_replace('/^(\d{2})-(\d{2})-(\d{2})(\d{2})$/', '\\1/\\2/\\4', $date); > "2003-01-02" $temp = preg_replace('/^(\d{2})-(\d{2})-(\d{4})$/', '\\3/\\1/\\2', $date); It's also a good idea to do a test to make sure the initial date is in the format you expect it to be: if ($temp == $date) { echo 'WAIT a second... Your initial date was bad.'; } --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php