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);
}
Copy after login
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
http://www.bkjia.com/PHPjc/1098692.htmlwww.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:...