Home >Backend Development >PHP Tutorial >How to get yesterday, today and tomorrow's date in PHP, php get_PHP tutorial

How to get yesterday, today and tomorrow's date in PHP, php get_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:59:311029browse

How to get yesterday, today and tomorrow's date in PHP, php gets

The example in this article describes the method of getting yesterday, today and tomorrow's date in PHP. Share it with everyone for your reference, the details are as follows:

//PHP返回昨天的日期
function get_last_date() {
 $tomorrow = mktime(0,0,0,date("m"),date("d")-1,date("Y"));
 return date("Y-m-d", $tomorrow);
}
//PHP返回今天的日期
function get_today_date() {
 $today=date("Y-m-d");
 return today;
}
//PHP返回明天的日期
function get_tomorrow_date() {
 $tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
 return date("Y-m-d", $tomorrow);
}

Readers who are interested in more PHP-related content can check out the special topics of this site: "Summary of PHP Date and Time Usage", "Summary of PHP Common Functions and Techniques" and "Introduction to PHP Object-Oriented Programming Tutorial"

I hope this article will be helpful to everyone in PHP programming.

Articles you may be interested in:

  • PHP uses strtotime to get the dates of last month, next month, and this month
  • php gets horoscope information based on date or timestamp and zodiac signs and other information
  • PHP gets the weeks of the year and the start and end dates of each week
  • How to get the website Baidu snapshot date with PHP
  • PHP gets the current date and Time and formatting method parameters
  • PHP method to get the specific date of Monday this week
  • PHP method to get the start date and end date of this week
  • PHP method to get the year Methods for the start and end dates of each week
  • Get the start and end times of each week and month between the specified dates in PHP
  • Get the last month, next month, and this month in PHP Date (strtotime, date)
  • How to use PHP to get the start date and end date of the month where the specified date is located
  • PHP get the start date and end date of the week (month) where the current date is (implementation code )
  • Use php to get the codes for this week, last week, this month, last month, and this quarter's dates

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1098692.htmlTechArticleHow to get yesterday, today and tomorrow’s date in PHP, php gets the date in this article describes how to get yesterday, today and tomorrow in PHP date method. Share it with everyone for your reference, the details are as follows:...
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