很多时候我们喜欢用js来获取日期和时间,但这仅仅是客户端的。
我们可以用php的date函数即可来获取服务器上的时间:
//将时区设置为中国
date_default_timezone_set("PRC");
echo date("Y-m-d l H:i:s A");
//例输出:2010-03-06 Saturday 11:51:29 AM
?>
Statement: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