时间:2021-07-01 10:21:17 帮助过:20人阅读
private function toTimeStamp ($dateTimeString = NULL) {
if (!$dateTimeString) {
$dateTimeString = time();
}
$numeric = '';
$add_space = false;
for($i=0;$i
if($add_space) {
$numeric .= ' ';
$add_space = false;
}
} else {
$numeric .= $dateTimeString[$i];
$add_space = true;
}
}
$numeric_array = explode(' ',$numeric,6);
if(sizeof($numeric_array)<3 || ($numeric_array[0]==0 && $numeric_array[1]==0 && $numeric_array[2]==0)) {
throw new Exception($dateTimeString . ' is an invalid parameter', 5);
} else {
$result = mktime(intval($numeric_array[3]), intval($numeric_array[4]), intval($numeric_array[5]),
intval($numeric_array[1]), intval($numeric_array[2]), intval($numeric_array[0])) ;
}
return $result;
}
http://www.bkjia.com/PHPjc/445012.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445012.htmlTechArticlephp 日期转换成日时截 private function toTimeStamp ($dateTimeString = NULL) { if (!$dateTimeString) { $dateTimeString = time(); } $numeric = ''; $add_space = false; for($i=0...