Home  >  Article  >  php教程  >  格式化日期字符串为unix时间戳

格式化日期字符串为unix时间戳

PHP中文网
PHP中文网Original
2016-05-26 08:21:101204browse


getTimestamp());
$dt = DateTime::createFromFormat('Y-m-d', $str2);
$dt->setTime(0, 0, 0);
var_dump($dt->getTimestamp());
?>

                       

           

2. [代码]#方案2(使用正则匹配)   

<br/>

           

           

           

3. [代码]执行结果    

int(1410762332) int(1410710400)

           

       

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn