Home > Backend Development > PHP Tutorial > php时间解决方法

php时间解决方法

WBOY
Release: 2016-06-13 12:13:44
Original
913 people have browsed it

php时间
如何把一个日期$time=date("Y-m-d-H-i")的数据提取出前三位?
------解决思路----------------------

本帖最后由 fdipzone 于 2015-01-15 16:50:09 编辑
<br />$time=date("Y-m-d-H-i");<br />echo preg_replace('/(\d+)-(\d+)-(\d+)-(\d+)-(\d+)/', '${1}年${2}月${3}日', $time); // 2015-01-15<br />
Copy after login
Related labels:
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