Home>Article>Backend Development> How to convert date to timestamp in php

How to convert date to timestamp in php

hzc
hzc Original
2020-06-10 15:13:48 2310browse

How to convert date to timestamp in php

Convert date to timestamp in php:

Convert date to timestamp

PHP provides functions to facilitate Convert various forms of dates into timestamps. The main functions of this class are:

strtotime(): Parse the date and time description of any English text into a timestamp. mktime(): Get timestamp from date.

The strtotime() function is used to convert the date represented by the English text string into a timestamp. It is the inverse function of date() and returns the timestamp successfully, otherwise it returns FALSE.

Syntax:

int strtotime ( string time [, int now] )

The parameter time is the parsed string, which is the date represented according to the GNU date input format.

Example:

"; //输出明天此时的时间戳 ?>

Recommended tutorial: "php tutorial"

The above is the detailed content of How to convert date 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