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

What is the method to convert time to timestamp in php

王林
Release: 2023-03-07 12:42:01
Original
2564 people have browsed it

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);
Copy after login

Use the function to convert date to UNIX timestamp: strtotime()

General form:

strtotime('2010-03-24 08:15:42');
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template