Implementation code for obtaining server time using PHP_PHP tutorial

WBOY
Release: 2016-07-21 15:07:58
Original
694 people have browsed it

Many times we like to use js to get the date and time, but this is only on the client side.
We can use PHP’s date function to get the time on the server:

Copy the code The code is as follows:

//Set the time zone to China
date_default_timezone_set("PRC");
echo date("Y-m-d l H:i:s A");
//Example output :2010-03-06 Saturday 11:51:29 AM
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327502.htmlTechArticleMany times we like to use js to get the date and time, but this is only on the client side. We can use PHP's date function to get the time on the server: Copy the code The code is as follows...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!