Home  >  Article  >  Backend Development  >  What is the timestamp conversion function in php

What is the timestamp conversion function in php

王林
王林Original
2020-09-29 10:45:401823browse

The timestamp conversion function in php is date(), such as [date("Y-m-d H:i:s",time())]. "Y-m-d H:i:s" represents the converted date format, and the time() function is used to obtain the timestamp of the current time.

What is the timestamp conversion function in php

Time stamp conversion function:

(Recommended tutorial: php video tutorial)

date("Y-m-d H:i:s",time())

"Y-m-d H:i:s" is the converted date format, and time() is the timestamp to obtain the current time.

If it is date("Y-m-d H:i:s", time()), the hours, minutes and seconds will be displayed together; if it is date("Y-m-d ", time()), only the year, month and day will be displayed.

For example:

date("Y-m-d H:i:s",time())

converted to:

2010-07-18 18:42:48

Related recommendations: php training

The above is the detailed content of What is the timestamp conversion function in php. For more information, please follow other related articles on the PHP Chinese website!

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