Php date processing experience set. Combine the functiondateserial ($ nyear, $ nmonth, $ nday) {returndate (Ynj, mktime (, 0, $ nmonth, $ nday, $ nyear);} $ now_rqdate (Ynj); the current date is merged by year, month, or day.
Function dateserial ($ nyear, $ nmonth, $ nday)
{
Return date ("Y/n/j", mktime (0, 0, 0, $ nmonth, $ nday, $ nyear ));
}
$ Now_rq = date ("Y/n/j"); // go to the current date
$ Year = date (Y); // Obtain the year
$ Month = date (m); // month
$ Month = date (j); // Get the day
// Obtain the first and last days of the quarter from the month
Switch ($ month ){
Case 1:
Case 2:
Case 3:
$ Quarter_begin = dateserial ($ year-1, 10, 1 );
$ Quarter_end = dateserial ($ year-1, 12, 31 );
Break;
Case 4:
Case 5:
Case 6:
$ Quarter_begin = dateserial ($ year, 1, 1 );
$ Quarter_end = dateserial ($ year, 3,31 );
Break;
Case 7:
Case 8:
Case 9:
$ Quarter_begin = dateserial ($ year, 4, 1 );
$ Quarter_end = dateserial ($ year, 6, 30 );
Break;
Case 10:
Case 11:
Case 12:
$ Quarter_begin = dateserial ($ year, 7,1 );
$ Quarter_end = dateserial ($ year, 9, 30 );
Break;
}
Invalid function dateserial ($ nyear, $ nmonth, $ nday) {return date ("Y/n/j", mktime (, 0, $ nmonth, $ nday, $ nyear) ;}$ now_rq = date ("Y/n/j"); // go to the current date $...