Home > php教程 > php手册 > PHP 获取当前日期及格式化,php获取当前日期

PHP 获取当前日期及格式化,php获取当前日期

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:26:47
Original
979 people have browsed it

PHP 获取当前日期及格式化,php获取当前日期

date('Y-m-d H:i:s',time());
Copy after login

PHP怎获取当前时间

要设置时区,PHP默认的不是中国的时区,是格林威治时间。所以设置一下时区就可以搞定! date_default_timezone_set('Etc/GMT-8'); //这里设置了时区
echo date("Y-m-d H:i:s");
?>
 

问在PHP中取当前日期的时间戳(年-月-日)该怎写?

用date函数格式化一下就好了!
echo date("Y-m-d",time());
格式化字符串说明见图片~
希望我的回答对你有所帮助!呵呵~



 

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
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template