note 53853 deleted from function.strtotime by derick
| From: | derick@php.net | Date: | Sat, 08 Oct 2005 12:58:33 +0000 |
| Subject: | note 53853 deleted from function.strtotime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96674@lists.php.net to get a copy of this message | ||
Note Submitter: brett at medeaproject dot co dot za
----
Got irritated using strtotime to try and parse a SQL server timestamp to a unix time stamp...
So i wrote this little function hopesomeone else finds it useful
function mssql_date_parser($indate){
//YYYY-MM-DD HH:mm:ss.splits
$indate = explode(" ", $indate);
$dateArr = explode("-", $indate[0]);
$timeArr = explode(":", $indate[1]);
$timeArr[2] = substr($timeArr[2],0, strpos($timeArr[2],"."));
$outdate = mktime(
$timeArr[0],
$timeArr[1],
$timeArr[2],
$dateArr[1],
$dateArr[2],
$dateArr[0]
);
return $outdate;
}