Home  >  Article  >  Backend Development  >  What is the method to convert time to timestamp in php

What is the method to convert time to timestamp in php

王林
王林Original
2020-11-06 11:38:322491browse

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);].

What is the method to convert time to timestamp in php

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!

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