: This article mainly introduces the php acquisition date (the day before yesterday, tomorrow, this week, this month, this quarter, and this year). If you are interested in PHP tutorials, refer to it.
- $ Begin_day = date ("Y-m-d 00:00:00 ");
- $ End_day = date ("Y-m-d 23:59:59 ");
-
- $ Last_begin = date ("Y-m-d 00:00:00", strtotime ("last days "));
- $ Last_end = date ("Y-m-d 23:59:59", strtotime ("last days "));
-
- $ Next_begin = date ("Y-m-d 00:00:00", strtotime ("next days "));
- $ Next_end = date ("Y-m-d 23:59:59", strtotime ("next days "));
-
- $ Month_times = strtotime (date ("Y-m "));
- $ Monthday = date ("t ");
- $ Month = date ("n ");
- $ Begin_this_week = date ("Y-m-d 00:00:00", strtotime ("last Sunday + 1 day "));
- $ End_this_week = date ("Y-m-d 23:59:59", strtotime ("next Sunday "));
-
- $ Begin_this_month = date ('Y-m-01 00:00:00 ');
- $ End_this_month = date ("Y-m-$ monthday 23:59:59", strtotime ("this month", $ month_times ));
-
- If ($ month = 1 | $ month = 2 | $ month = 3 ){
- $ Begin_this_quarter = date ('Y-01-01 00:00:00 ');
- $ End_this_quarter = date ("Y-03-31 23:59:59 ");
- } Elseif ($ month = 4 | $ month = 5 | $ month = 6 ){
- $ Begin_this_quarter = date ('Y-04-01 00:00:00 ');
- $ End_this_quarter = date ("Y-06-30 23:59:59 ");
- } Elseif ($ month = 7 | $ month = 8 | $ month = 9 ){
- $ Begin_this_quarter = date ('Y-07-01 00:00:00 ');
- $ End_this_quarter = date ("Y-09-30 23:59:59 ");
- } Else {
- $ Begin_this_quarter = date ('Y-10-01 00:00:00 ');
- $ End_this_quarter = date ("Y-12-31 23:59:59 ");
- }
-
- $ Begin_this_year = date ('Y-01-01 00:00:00 ');
- $ End_this_year = date ('Y-12-31 23:59:59 ');
-
- // The first quarter is the month of July 31, the second quarter is the month of July 30, the third quarter is the month of July 30, and the fourth quarter is the month of July 31
- Echo "today | ";
- Echo "the day before yesterday | ";
- Echo "tomorrow | ";
- Echo "this week | ";
- Echo "this month | ";
- Echo "this quarter | ";
- Echo "this year ";
The above describes the php acquisition date (that day, the day before yesterday, tomorrow, this week, this month, this quarter, this year), including the content, if you are interested in PHP tutorials.