Obtain the year, month, and day of the current week from the year, month, and day of the current week from the year, month, and day of the current day.
PHP code
// Obtain the end date of the latest week corresponding to the year, month, and Day. the function GetClearWeek () {$ year_month_day_over = array (); $ year = date ('Y '); // Four-digit year $ month = date ('n'); // 1 to 12 $ day_of_month = date ('J '); // day of month 1-31 $ day_of_week = date ('N'); // Day of Week 1-7 $ day_of_year = date ('Z') + 1; // the day of the 1-month $ days_of_month = date ('t'); // The number of days that the current month should have $ day_should_over = $ day_of_month-$ day_of_week + 7; if ($ day_should_over> $ days_of_month) {$ month_over = $ month + 1; if ($ month_over> 12) {$ year_month_day_over = array ('Year _ over' => $ year + 1, 'Month _ over' => 1, 'Day _ over' => $ day_should_over-$ days_of_month,);} else {$ year_month_day_over = array ('Year _ over' => $ year, 'month _ over' => $ month + 1, 'day _ over' => $ day_should_over-$ days_of_month ,);}} else {$ year_month_day_over = array ('Year _ over' => $ year, 'Month _ over' => $ month, 'day _ over' => $ day_should_over ,);} return $ year_month_day_over ;}