Return to Snippet

Revision: 14788
at June 11, 2009 12:24 by withremote


Initial Code
function readableDateTime($mySQLDateTime) {
	list($date, $time) = split(' ',$mySQLDateTime);
	
	$d = explode("-", $date);
	$t = explode(":", $time);
	
	$datefixed = $d[1]."/".$d[2]."/".$d[0];
		if ($t[0] <= 12) {
		$timefix = $t[0].":".$t[1]." AM";
		}
		if ($t[0] > 12) {
		$timefix = ($t[0] - 12 ).":".$t[1]." PM";
		}
	echo $datefixed." ".$timefix;
}

Initial URL

                                

Initial Description
converts DateTIME, like 2009-06-11 10:30:40 into 06/11/2009 10:30 AM

Initial Title
Change MySql DATETIME into something more friendly

Initial Tags

                                

Initial Language
PHP