Home > Backend Development > PHP Tutorial > PHP date format conversion summary

PHP date format conversion summary

巴扎黑
Release: 2016-11-22 16:53:51
Original
1139 people have browsed it

<?php
//将当前时间转換成yyyy-mm-dd格式串,再转换成日期格式,绕了一圈哈
echo strtotime(date(&#39;Y-m-d&#39;,time()).&#39; 00:00:00&#39;);
//将GNU 日期输入格式的字符转换成时间
echo strtotime(&#39;now&#39;);
//标准的字符串转换成时间
$t = &#39;2012-9-10 15:18:06&#39;;
$time = strtotime($t);
//将时间转换成日期字符yyyymmdd,再转换成整型格式
$d = intval(date(&#39;Ymd&#39;,$time));
echo &#39;付款时间:&#39;.$d;
?>
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template