Home > Article > Backend Development > What is the method to convert time to timestamp in php
The method for php to convert time into timestamp is: [strtotime('2010-03-24 08:15:42');]. If you want to convert the timestamp into a date, you can use the method [date('Y-m-d H:i:s', 1156219870);].
The method is as follows:
(Learning video recommendation: java course)
UNIX timestamp Use the function to convert to date: date()
General form:
date('Y-m-d H:i:s', 1156219870);
Use the function to convert date to UNIX timestamp: strtotime()
General form:
strtotime('2010-03-24 08:15:42');
Related recommendations: php training
The above is the detailed content of What is the method to convert time to timestamp in php. For more information, please follow other related articles on the PHP Chinese website!