Home > php教程 > PHP源码 > body text

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

PHP中文网
Release: 2016-05-26 08:21:10
Original
1204 people have browsed it


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

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

<br/>
Copy after login

3. [代码]执行结果

int(1410762332) int(1410710400)
Copy after login

           

       

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template