daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // determine days number to next monday
  2. $daysToNextMo = ($defaultWeekDay == 0) ? 1 : (8 - $defaultWeekDay);
  3.  
  4. // determine days number to prev sunday
  5. $daysToPrevSu = ($defaultWeekDay == 0) ? 7 : $defaultWeekDay;
  6.  
  7. // determine start date of next week
  8. // next monday day is out of days in defaultMonth
  9. if (($defaultDay + $daysToNextMo) > date('t', $defaultTimestamp)) {
  10.   $nextDay = $daysToNextMo - (date('t', $defaultTimestamp) - $defaultDay);
  11.   if ($defaultMonth == 12) {
  12.     $nextMonth = 1;
  13.     $nextYear = $defaultYear + 1;
  14.   }
  15.   else {
  16.     $nextMonth = $defaultMonth + 1;
  17.     $nextYear = $defaultYear;
  18.   }
  19. }
  20. else {
  21.   $nextDay = $defaultDay + $daysToNextMo;
  22.   $nextMonth = $defaultMonth;
  23.   $nextYear = $defaultYear;
  24. }
  25. $nextDate = $nextYear.'-'.$nextMonth.'-'.$nextDay;
RAW Paste Data
Top