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.
Reprinted from http://hi.baidu.com/panez/item/bc88803f487955f2a884289d
http://www.bkjia.com/PHPjc/776509.html www.bkjia.com true http://www.bkjia.com/PHPjc/776509.html techarticle this Monday echo date (' y-m-d ', (Time ()-((Date (' W ') ==0?7:date (' W ')-1) *24*3600)),//w is the number of days of the week, here 0 is Sunday this Sunday echo date (' Y-m-d ', (Time () + (7-(the date (' W ') ==0?7 ...