Home > Backend Development > PHP Tutorial > PHP about time date strtotime basic analysis

PHP about time date strtotime basic analysis

WBOY
Release: 2016-07-28 08:29:09
Original
1195 people have browsed it

Recently, I have used PHP more frequently for time processing. Now I will sort out the knowledge points. The

time()

time() function returns the Unix timestamp of the current time.

$t=time();
echo($t . "<br />");
Copy after login
The $t object here outputs a number. This number represents the total number of seconds since 1970-01-01.

It feels useless. At this time, we need to use the date function to convert the object into the date we need.

date(format,,timestamp)

The date function format is very flexible and can be used in various ways, which is enough to meet various situations you encounter during the development process.

format: required, specifies the output format of the timestamp;

timestamp: optional, specifies the time

date_default_timezone_set(PRC); /*Adjust the time to Beijing time, php5 default is GMT*/

To be continued,. . .

The above has introduced the basic analysis of time date strtotime in PHP, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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