/ Published in: PHP
converts DateTIME, like 2009-06-11 10:30:40 into 06/11/2009 10:30 AM
Expand |
Embed | Plain Text
function readableDateTime($mySQLDateTime) { $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"; } }
Comments
Subscribe to comments
You need to login to post a comment.

I used to to it that way as well until I realised that php can handle it much much better and more efficient.
echo date('m/d/Y H:m A',strtotime($mySQLDateTime);
So what you do in 15 lines I did in 1.