Querying SQL Server (MSSQL) columns in PHP (Ubuntu / PHP 5.2.4), my date columns are coming out looking like this:
May 16 2013 12:00:00:000AM
strtotime won't parse them.
Tried this:
preg_match("/^([a-zA-Z]{3}) ([0-9]{1,2}) ([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2}):[0-9]{3}([apmAPM]{2})$/",$time_string,$regs);
$month = $regs[1];
$day = $regs[2];
$year = $regs[3];
$hour = $regs[4];
$minute = $regs[5];
$second = $regs[6];
$ampm = $regs[7];
$converted_time_string = $month." ".$day." ".$year." ".$hour.":".$minute.":".$second.$ampm;
$actual_time = strtotime($converted_time_string);
return $actual_time;
But it's having trouble with some dates, for example:
Aug 1 2013 12:00:00:000AM
Any more reliable suggestions on how to do this? Upgrading PHP not an option at this time.