我在将数据库中存储的日期的unix时间戳输出时遇到了困难。
$activeWorkRow['WorkDate'] = "9/24/2015 1:45:53 PM";
$locateDate = $activeWorkRow['WorkDate'];
$locateDate = str_replace('/', '-', $locateDate);
//$locateDate = date('m-d-Y', strtotime($locateDate));
//$locateDate = strtotime(date($locateDate));
echo $locateDate."<br>";
输出:
9-24-2015 1:45:53 PM
下一步:
$locateDate = $activeWorkRow['WorkDate'];
$locateDate = str_replace('/', '-', $locateDate);
$locateDate = date('m-d-Y', strtotime(locateDate));
//$locateDate = strtotime(date($locateDate));
输出:
12-31-1969
我正在尝试获取 Unix 时间戳,以便与其他时间进行比较。