Monday
echo Date (' y-m-d ', (Time ()-((Date (' W ') ==0?7:date (' W ') ')-1) *24*3600)); W is the number form of the day of the week, where 0 is Sunday
This Sunday
echo Date (' y-m-d ', (Time () + (7-(' W ') ==0?7:date (' W ')) *24*3600)); Also use W to calculate the number of days related to the current and Sunday
Last Monday
echo Date (' y-m-d ', Strtotime ('-1 Monday ', Time ())); No matter what day it is, -1 Monday is the last effective week
Last Sunday
echo Date (' y-m-d ', Strtotime ('-1 Sunday ', Time ())); Last valid Sunday, same applies to other weeks
This month
echo Date (' y-m-d ', strtotime (date (' Y-m ', Time ()). ' -01 00:00:00 ')); Generate directly with Strtotime
Last day of the 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, 28-31 days
Last month
echo Date (' y-m-d ', Strtotime ('-1 month ', Strtotime (date (' Y-m ', Time ()). ' -01 00:00:00 ')); This month, the direct strtotime minus one months.
Last day of last month
echo Date (' y-m-d ', strtotime (date (' Y-m ', Time ()). ' -01 00:00:00 ')-86400); Minus one day this month is the last of the month.
PHP a line of code to get this Monday, this Sunday, on Monday, Upper Sunday, this month, the last day of this month, the last month of last month to turn