You are here

public static function PHPExcel_Calculation_DateTime::DAYS360 in Loft Data Grids 7.2

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

* 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 twelve 30-day months. * * Excel Function: * DAYS360(startDate,endDate[,method]) * * @access public * @category Date/Time Functions *

Parameters

mixed $startDate Excel date serial value (float), PHP date timestamp (integer),: * PHP DateTime object, or a standard date string * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), * PHP DateTime object, or a standard date string * @param boolean $method US or European Method * FALSE or omitted: U.S. (NASD) method. If the starting date is * the last day of a month, it becomes equal to the 30th of the * same month. If the ending date is the last day of a month and * the starting date is earlier than the 30th of a month, the * ending date becomes equal to the 1st of the next month; * otherwise the ending date becomes equal to the 30th of the * same month. * TRUE: European method. Starting dates and ending dates that * occur on the 31st of a month become equal to the 30th of the * same month. * @return integer Number of days between start date and end date

1 call to PHPExcel_Calculation_DateTime::DAYS360()
PHPExcel_Calculation_DateTime::YEARFRAC in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* YEARFRAC * * Calculates the fraction of the year represented by the number of whole days between two dates * (the start_date and the end_date). * Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits…

File

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

Class

PHPExcel_Calculation_DateTime
PHPExcel_Calculation_DateTime

Code

public static function DAYS360($startDate = 0, $endDate = 0, $method = false) {
  $startDate = PHPExcel_Calculation_Functions::flattenSingleValue($startDate);
  $endDate = PHPExcel_Calculation_Functions::flattenSingleValue($endDate);
  if (is_string($startDate = self::_getDateValue($startDate))) {
    return PHPExcel_Calculation_Functions::VALUE();
  }
  if (is_string($endDate = self::_getDateValue($endDate))) {
    return PHPExcel_Calculation_Functions::VALUE();
  }
  if (!is_bool($method)) {
    return PHPExcel_Calculation_Functions::VALUE();
  }

  // Execute function
  $PHPStartDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($startDate);
  $startDay = $PHPStartDateObject
    ->format('j');
  $startMonth = $PHPStartDateObject
    ->format('n');
  $startYear = $PHPStartDateObject
    ->format('Y');
  $PHPEndDateObject = PHPExcel_Shared_Date::ExcelToPHPObject($endDate);
  $endDay = $PHPEndDateObject
    ->format('j');
  $endMonth = $PHPEndDateObject
    ->format('n');
  $endYear = $PHPEndDateObject
    ->format('Y');
  return self::_dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, !$method);
}