Home >Backend Development >PHP Problem >How to convert timestamp to date in php
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());].
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:
<?php var_dump(time()); //获取当前时间戳 int(1502245603) $time = date('Y-m-s h:i:s',time());
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!