Copy CodeThe code is as follows:
echo Date ("Ymd", Strtotime ("Now"), "\ n";
echo Date ("Ymd", Strtotime ("1 week Monday")), "\ n";
echo Date ("Ymd", Strtotime ("1 week Sunday")), "\ n";
echo Date ("Ymd", Strtotime ("+0 Week Monday")), "\ n";
echo Date ("Ymd", Strtotime ("+0 Week Sunday")), "\ n";
Date (' n ') months
Date ("W") Week of the week
Date ("T") number of days of the month
Echo '
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";
$getMonthDays = Date ("T", mktime (0, 0, 0,date (' n ') + (date (' n ')-1)%3,1,date ("Y"));//Last month of the quarter
Echo '
This quarter:
';
echo Date (' y-m-d h:i:s ', mktime (0, 0, 0,date (' n ')-(date (' n ')-1)%3,1,date (' Y ')), "\ n";
echo Date (' y-m-d h:i:s ', Mktime (23,59,59,date (' n ') + (date (' n ')-1)%3, $getMonthDays, date (' Y '))), "\ n";
http://www.bkjia.com/PHPjc/320434.html www.bkjia.com true http://www.bkjia.com/PHPjc/320434.html techarticle Copy the code as follows: Echo date ("Ymd", Strtotime ("Now"), "\ n", Echo date ("Ymd", Strtotime ("1 week Monday"), "\ n", Echo date ("Ym D ", Strtotime ("-1 week Sunday "))," \ n "; Echo dat ...