Wednesday, January 21, 2015

Convert from MySQL datetime to another format with PHP

// $datetime is something like: 2014-01-31 13:05:59
$time = strtotime($datetimeFromMysql);
$myFormatForView = date("d-m-Y g:i A", $time);
// $myFormatForView is something like: 01/31/14 1:05 PM

No comments:

Post a Comment