コード例 #1
0
ファイル: Calc.php プロジェクト: ulrikkold/cal
 /**
  * Compares two dates
  *
  * @param int $day1
  *        	the day of the month
  * @param int $month1
  *        	the month
  * @param int $year1
  *        	the year. Use the complete year instead of the
  *        	abbreviated version. E.g. use 2005, not 05.
  *        	Do not add leading 0's for years prior to 1000.
  * @param int $day2
  *        	the day of the month
  * @param int $month2
  *        	the month
  * @param int $year2
  *        	the year. Use the complete year instead of the
  *        	abbreviated version. E.g. use 2005, not 05.
  *        	Do not add leading 0's for years prior to 1000.
  *        	
  * @return int 0 if the dates are equal. 1 if date 1 is later, -1 if
  *         date 1 is earlier.
  *        
  * @access public
  * @static
  *
  */
 static function compareDates($day1, $month1, $year1, $day2, $month2, $year2)
 {
     $ndays1 = Calc::dateToDays($day1, $month1, $year1);
     $ndays2 = Calc::dateToDays($day2, $month2, $year2);
     if ($ndays1 == $ndays2) {
         return 0;
     }
     return $ndays1 > $ndays2 ? 1 : -1;
 }