php method to convert time into numbers: First create a PHP sample file; then enter the statement "echo strtotime("")" to convert time into numbers.
Recommended: "PHP Video Tutorial"
The code is as follows:
echo strtotime ("2012-03-22"); //结果1332374400 //说明:返回2012年3月22日0点0分0秒时间戳 echo time(); //说明:获取当前时间的时间戳
Related introduction:
The strtotime() function parses any English text date or time description into a Unix timestamp (number of seconds since January 1 1970 00:00:00 GMT).
The time() function returns the number of seconds since the Unix epoch (January 1 1970 00:00:00 GMT).
The above is the detailed content of How to convert time to number in php. For more information, please follow other related articles on the PHP Chinese website!