This Monday
Echo date ('Y-m-d', (Time ()-(date ('W') = 0? 7: Date ('W')-1) * 24*3600); // W indicates the number of weeks. 0 indicates Sunday.
This Sunday
Echo date ('Y-m-d', (Time () + (7-(date ('W') = 0? 7: Date ('W') * 24*3600); // W is also used, which is calculated based on the number of days currently related to Sunday.
Last Monday
Echo date ('Y-m-d', strtotime ('-1 Monday', time (); // no matter the number of today, -1 Monday indicates the last valid Week.
Last Sunday
Echo date ('Y-m-d', strtotime ('-1 Sunday', time (); // The last valid Sunday, also applies to other weeks
1st day of this month
Echo date ('Y-m-d', strtotime (date ('Y-m', time (). '-01 00:00:00'); // generate strtotime directly
Last day of this month
Echo date ('Y-m-d', strtotime (date ('Y-m', time ()). '-'. date ('T', time ()). '00:00:00'); // t indicates the number of days in the current month, 28 to 31 days.
1st day of last month
Echo date ('Y-m-d', strtotime ('-1 month', strtotime (date ('Y-m', time ()). '-01 00:00:00'); // subtract one month from strtotime on January 1, 1st day of this month.
Last day of last month
Echo date ('Y-m-d', strtotime (date ('Y-m', time ()). '-01 00:00:00')-86400); // minus one day on January 1, 1st day of this month is the last day of the previous month.