Home > Article > Backend Development > How to implement time function conversion in php
php method to implement time function conversion: 1. Obtain the timestamp, the code is [$todaytime=strtotime("today")]; 2. The timestamp conversion function, the code is [date("Y-m-d H: i:s",time())].
[Related learning recommendations: php graphic tutorial]
php method to implement time function conversion :
1.php to get the timestamp of today's zero o'clock. To get the unix timestamp of zero o'clock, you can use
$todaytime=strtotime(“today”)
and then use
date("Y-m-d H:i",$todaytime)
to convert to date. .
2. Convert timestamp to date
Time stamp conversion function:
date("Y-m-d H:i:s",time())
"Y-m-d H:i:s" is the converted date format,
date("Y-m-d H:i:s",time())is converted to:
2010-07-18 18:42:48 date("Y-m-d",time())
Related learning recommendations:php programming (video)
The above is the detailed content of How to implement time function conversion in php. For more information, please follow other related articles on the PHP Chinese website!