PHP gets last week, this week, last month, this month, this quarter, last quarter
Source: http://hudeyong926.iteye.com/blog/729193
Last week:
'; Echo date ("Y-m-d h:i:s", mktime (0, 0, 0,date ("M"), Date ("D")-date ("W") +1-7,date ("Y")), "\ n", Echo date ("Y-m-d h:i:s", Mktime (23,59,59,date ("M"), Date ("D")-date ("W") +7-7,date ("Y")), "\ n"; Echo '
Week:
'; Echo date ("Y-m-d h:i:s", mktime (0, 0, 0,date ("M"), Date ("D")-date ("W") +1,date ("Y")), "\ n", Echo date ("Y-m-d h:i:s", Mktime (23,59,59,date ("M"), Date ("D")-date ("W") +7,date ("Y")), "\ n"; Echo '
Last month:
'; Echo date ("Y-m-d h:i:s", mktime (0, 0, 0,date ("M") -1,1,date ("Y")), "\ n"; Echo date ("Y-m-d h:i:s", Mktime (23,59,59,date ("M"), 0,date ("Y")), "\ n"; Echo '
Month:
'; Echo date ("Y-m-d h:i:s", mktime (0, 0, 0,date ("M"), 1,date ("Y")), "\ n", Echo date ("Y-m-d h:i:s", Mktime (23,59,59,date (" M "), Date (" T "), Date (" Y "))," \ n "; $season = Ceil ((date (' n '))/3);//The month of the first quarter echo '
This quarter:
'; Echo date (' y-m-d h:i:s ', mktime (0, 0, 0, $season *3-3+1,1,date (' Y ')), "\ n"; Echo date (' y-m-d h:i:s ', Mktime (23,59,59,$ Season*3,date (' t ', mktime (0, 0, 0, $season *3,1,date ("y"))), date (' Y ')), "\ n"; $season = Ceil ((date (' n '))/3) -1;//last quarter was the first quarter of ECHO '
Last quarter:
'; Echo date (' y-m-d h:i:s ', mktime (0, 0, 0, $season *3-3+1,1,date (' Y ')), "\ n"; Echo date (' y-m-d h:i:s ', Mktime (23,59,59,$ Season*3,date (' t ', mktime (0, 0, 0, $season *3,1,date ("y"))), "\ n",?> php two dates subtracted by the number of days
?