In a mysql table I have the date and time stored a 2007-08-18 00:00:00 which is set by the datetime format.
I know how to get the date out of it using the explode function as I want the reorganize the, how would I get the time from the cell so that I can re organize it,
@Declan1991Aug 20.2007 — #Well firstly you need an array of the months that correspond to the 01 to 12 section of the date. Then you need to get the appropriate variable out of the exploded string, and use it as the index to get the month in text. Then you need to add the appropriate parts of the exploded date to it.
Something like this: [code=php] $result = "2007-08-18 00:00:00"; $months = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); $split = explode(" ",$result); $dte = explode("-",$split[0]); $tme = explode(":",$split[1]); $ap = ($tme[0] > 11)?"am":"pm"; $tme[0] = ($tme[0] > 11)?$tme[0]:$tme[0]-12; $rdte = "$months[$dte[1]]$dte[2] at $tme[0]:$tme[1] $ap"; [/code] $rdte is the result, $result is the date from the database.