Home > php教程 > php手册 > PHP常用库函数,php库函数

PHP常用库函数,php库函数

WBOY
Release: 2016-06-13 08:51:10
Original
1339 people have browsed it

PHP常用库函数,php库函数

1.时间和日期
  • 如何获取时间戳 time()--从1970年开始计算的毫秒数
echo time();
Copy after login
  • 日期
echo date(<span>'</span><span>Y-m-d H:i:s</span><span>'</span>);
Copy after login
  • 获取默认是时区
echo date_default_timezone_get();
Copy after login
  • 默认获得的时间和本地电脑时间不一致,需要设置相应的时区
date_default_timezone_set('Asia/Shanghai'); //设置为上海的时区
echo date(<span>'</span><span>Y-m-d H:i:s</span><span>'</span>);
Copy after login
  • 把时间戳转换成日期呈现出来
echo date(<span>'</span><span>Y-m-d H:i:s</span><span>'</span><span>,time());
echo </span><span>'</span><span><br/></span><span>'</span><span>;
echo date(</span><span>'</span><span>Y-m-d H:i:s</span><span>'</span>,time());
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template