How to convert time to number in php

藏色散人
Release: 2023-03-06 11:28:02
Original
3010 people have browsed it

php method to convert time into numbers: First create a PHP sample file; then enter the statement "echo strtotime("")" to convert time into numbers.

How to convert time to number in php

Recommended: "PHP Video Tutorial"

The code is as follows:

echo strtotime ("2012-03-22");
//结果1332374400
//说明:返回2012年3月22日0点0分0秒时间戳
echo time();
//说明:获取当前时间的时间戳
Copy after login

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!

Related labels:
php
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template