You are here

private static function PHPExcel_Calculation_DateTime::_dateDiff360 in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php \PHPExcel_Calculation_DateTime::_dateDiff360()

* Return the number of days between two dates based on a 360 day calendar * *

Parameters

integer $startDay Day of month of the start date: * @param integer $startMonth Month of the start date * @param integer $startYear Year of the start date * @param integer $endDay Day of month of the start date * @param integer $endMonth Month of the start date * @param integer $endYear Year of the start date * @param boolean $methodUS Whether to use the US method or the European method of calculation * @return integer Number of days between the start date and the end date

1 call to PHPExcel_Calculation_DateTime::_dateDiff360()
PHPExcel_Calculation_DateTime::DAYS360 in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* DAYS360 * * Returns the number of days between two dates based on a 360-day year (twelve 30-day months), * which is used in some accounting calculations. Use this function to help compute payments if * your accounting system is based on…

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php, line 71

Class

PHPExcel_Calculation_DateTime
PHPExcel_Calculation_DateTime

Code

private static function _dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, $methodUS) {
  if ($startDay == 31) {
    --$startDay;
  }
  elseif ($methodUS && ($startMonth == 2 && ($startDay == 29 || $startDay == 28 && !self::_isLeapYear($startYear)))) {
    $startDay = 30;
  }
  if ($endDay == 31) {
    if ($methodUS && $startDay != 30) {
      $endDay = 1;
      if ($endMonth == 12) {
        ++$endYear;
        $endMonth = 1;
      }
      else {
        ++$endMonth;
      }
    }
    else {
      $endDay = 30;
    }
  }
  return $endDay + $endMonth * 30 + $endYear * 360 - $startDay - $startMonth * 30 - $startYear * 360;
}