- $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 January 1 to March 31, the second quarter is April 1 to June 30, the third quarter is July January-September 30, and the quarter is October January-December
- Echo "the day |" ;
- 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 (the day before yesterday, tomorrow, this week, this month, this quarter, this year), including aspects of the content, I hope to be interested in PHP tutorial friends helpful.