Home>Article>Backend Development> 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!