Home>Article>Backend Development> How to convert timestamp to date in php

How to convert timestamp to date in php

王林
王林 Original
2020-07-23 14:17:00 3513browse

The way PHP converts timestamps into dates is through the date() function. The date() function can format a timestamp into a more readable date and time. The specific usage method is: [date('Y-m-s h:i:s',time());].

How to convert timestamp to date in php

Function introduction:

(Recommended tutorial:php tutorial)

PHP date() Function formats a timestamp into a more readable date and time.

Function syntax:

string date( string $format [, int $timestamp])

Parameter description:

  • ##format Required. Specifies the format of the timestamp.

  • #timestamp Optional. Specify timestamp. The default is the current date and time.

Code implementation:


      

The above is the detailed content of How to convert timestamp to date 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