正则表达式修改字符串为时间格式

WBOY
Release: 2016-06-06 20:15:51
Original
950 people have browsed it

20160313t212947

改成 2016-03-13 21:29:47

正则表达式修改字符串为时间格式
有没有正则表达式简单一点搞定?

回复内容:

20160313t212947

改成 2016-03-13 21:29:47

正则表达式修改字符串为时间格式
有没有正则表达式简单一点搞定?

为什么用这种格式的时间?

使用 strtotime 函数

<code>$timestamp = strtotime('20160313t212947');
echo date('Y-m-d H-i-s', $timestamp);</code>
Copy after login
Related labels:
php
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!