Home > Backend Development > PHP Tutorial > 正则表达式修改字符串为时间格式

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:15:51
Original
1028 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
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template