Example #1
0
 /**
  * Returns week of the year, first Sunday is first day of first week
  *
  * @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
  *        	
  * @return int the number of the week in the year
  *        
  * @access public
  * @static
  *
  */
 static function weekOfYear($day = 0, $month = 0, $year = 0)
 {
     if (empty($year)) {
         $year = Calc::dateNow('%Y');
     }
     if (empty($month)) {
         $month = Calc::dateNow('%m');
     }
     if (empty($day)) {
         $day = Calc::dateNow('%d');
     }
     $iso = Calc::gregorianToISO($day, $month, $year);
     $parts = explode('-', $iso);
     $week_number = intval($parts[1]);
     return $week_number;
 }