Example #1
0
 /**
  * Find the month day of the beginning of week after given date,
  * using DATE_CALC_BEGIN_WEEKDAY
  *
  * Can return weekday of prev month.
  *
  * @param int $day
  *        	the day of the month, default is current local day
  * @param int $month
  *        	the month, default is current local month
  * @param int $year
  *        	the year in four digit format, default is current local year
  * @param string $format
  *        	the string indicating how to format the output
  *        	
  * @return string the date in the desired format
  *        
  * @access public
  * @static
  *
  */
 static function beginOfNextWeek($day = 0, $month = 0, $year = 0, $format = DATE_CALC_FORMAT)
 {
     if (empty($year)) {
         $year = Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Calc::dateNow('%d');
     }
     $date = Calc::daysToDate(Calc::dateToDays($day + 7, $month, $year), '%Y%m%d');
     $next_week_year = substr($date, 0, 4);
     $next_week_month = substr($date, 4, 2);
     $next_week_day = substr($date, 6, 2);
     return Calc::beginOfWeek($next_week_day, $next_week_month, $next_week_year, $format);
 }