At 11:51 AM 12/5/02 +1100, Justin French wrote:
on 05/12/02 11:37 AM, Rick Widmer ([EMAIL PROTECTED]) wrote:> $Hour = substr( $Date, 11, 2 ); > if( $Hour ) > 12 { > $Hour = $Hour - 12; > $AMPM = 'PM'; > } > > else { > $AMPM = 'AM'; > } > > echo substr( $Date, 5, 2 ), '/', substr( $Date, 8, 2 ), '/', > substr( $Date, 0, 4 ), ' ', $Hour, substr( $Date, 13, 6 ), $AMPM; Isn't this a little simpler? <? $newdate = date('n/j/Y g:i:s a', strtotime($date)); echo $newdate; ?> There's always more than one way to do something I guess :)
Yes, it is simpler to code, but it also takes almost twice as long to run. 1000 iterations with strtotime: 0.2296 seconds 1000 iterations with substr: 0.1308 seconds Doesn't matter much if you only do it once, but it can add up in a loop. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

