- var_dump: documentation ( source)
- time: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$time = array(
false,
'sdfasas',
'0000-00-00',
'0000-00-00 00:00:00',
'1231231',
'2013-03-02 02:03:03',
'2014-04-21',
);
function getJsonDate($unixTimestamp = null)
{
if (is_null($unixTimestamp)) {
$unixTimestamp = time();
}
return '/Date(' . ($unixTimestamp * 1000) . date('O') . ')/';
}
foreach($time as $s) {
$iStartTime = ((strtotime($s) >= 0) ? strtotime($s) : 0);
var_dump(getJsonDate($iStartTime));
}