How to convert time in php numbers

藏色散人
Release: 2023-03-03 11:44:02
Original
2716 people have browsed it

PHP method to convert digital time: first create a PHP sample file; then get the 0 o'clock timestamp of the day; finally use the "date("Y-m-d H:i:s",$dotime);" method to convert the digital Just convert the time into time format according to the format.

How to convert time in php numbers

Recommended: "PHP Tutorial"

php value conversion time and time conversion value

Code Example

This article mainly introduces the use of php numerical conversion time and time conversion numerical value, involving functions such as php strtotime and date to implement date string format and Unix timestamp format conversion related For operating skills, friends in need can refer to the following examples of this article to describe the use of PHP numerical conversion time and time conversion numerical value. Share it with everyone for your reference, the details are as follows:

echo $startime=strtotime(date("Y-m-d",time()));//当天0点时间戳
echo "
"; echo $endttime=strtotime(date("Y-m-d",time()).' 23:59:59');//当天23:59:59的INT类型时间戳 echo "
"; //把数值型转成时间字符型 $dotime="1357985479"; echo date("Y-m-d H:i:s",$dotime);//把数字型时间按格式转换成时间格 echo "
"; //输出当前时间字符串型 echo strtotime(date('Y-m-d H:i:s',time())); echo "
"; //把数值型转成字符串型 echo date('Y-m-d H:i:s','1357985479'); echo "
"; //把字符串型转成数值型 echo strtotime('Y-m-d H:i:s'); //echo "
"; //最近七天 echo strtotime("-7 days")
Copy after login

The running results are as follows:

1495065600
1495151999
2013-01-12 10:11:19
1495073470
2013-01-12 10:11:19
1494468670
Copy after login

The above is the detailed content of How to convert time in php numbers. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!