This Monday
echo date('Y-m-d',(time()-((date('w')==0?7:date('w'))-1) *24*3600)); //w is the numeric form of the day of the week, here 0 is Sunday
This Sunday
echo date('Y-m-d',(time()+(7-(date('w')==0?7:date('w')))*24*3600)); // Also use w to calculate based on the number of days related to Sunday
Last Monday
echo date('Y-m-d',strtotime('-1 monday', time())); //No matter what day it is, -1 monday is the previous valid weekday
Last Sunday
echo date('Y-m-d',strtotime('-1 sunday', time())); //The last valid Sunday, the same applies to other weeks
One day of this month
echo date('Y-m-d',strtotime(date('Y-m', time()).'-01 00:00:00')); //Generate directly from strtotime
Last day of this month
echo date('Y-m-d',strtotime(date('Y-m', time()).'-'.date('t', time()).' 00:00:00') ); //t is the number of days in the month, from 28 to 31 days
The first day of last month
echo date('Y-m-d',strtotime('-1 month', strtotime(date('Y-m', time()).'-01 00:00:00'))); // On the first day of this month, strtotime will be directly increased and subtracted by one month
The last day of the previous month
echo date('Y-m-d',strtotime(date('Y-m', time()).'-01 00:00:00')-86400); //One day minus one day of this month is It’s the last day of last month
Reprinted from http://hi.baidu.com/panez/item/bc88803f487955f2a884289d