How to implement the timestamp of today, yesterday and tomorrow in PHP

墨辰丷
Release: 2023-03-29 09:26:02
Original
1810 people have browsed it

This article mainly introduces the method of obtaining the timestamp of today, yesterday, and tomorrow in PHP. It analyzes the common usage techniques of strtotime function with examples. It is very simple and practical. Friends in need can refer to it.

The details are as follows:

echo strtotime(&#39;now&#39;),&#39;<br>&#39;;//现在
echo strtotime(&#39;today&#39;),&#39;<br>&#39;;//今天
echo strtotime(&#39;tomorrow&#39;),&#39;<br>&#39;;//明天
echo strtotime(&#39;yesterday&#39;),&#39;<br>&#39;;//昨天
Copy after login

The running results are as follows:

1469674869
1469664000
1469750400
1469577600

The rest of today Number of seconds:

echo $time_remain = strtotime(&#39;tomorrow&#39;) - time();
//输出:75531
Copy after login

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.

Related recommendations:

PHP comes with a method to verify whether the email, URL, and IP are legal. Detailed explanation of the function

PHP object , Case analysis of advanced features of patterns and practices

##How to use try{}catch{} in PHP

The above is the detailed content of How to implement the timestamp of today, yesterday and tomorrow in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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!