Home  >  Article  >  Backend Development  >  How to implement the timestamp of today, yesterday and tomorrow in PHP

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

墨辰丷
墨辰丷Original
2018-06-01 16:17:151854browse

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;;//昨天

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

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!

Statement:
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