public static function PHPExcel_Calculation_DateTime::EOMONTH in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php \PHPExcel_Calculation_DateTime::EOMONTH()
* EOMONTH * * Returns the date value for the last day of the month that is the indicated number of months * before or after start_date. * Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month. * * Excel Function: * EOMONTH(dateValue,adjustmentMonths) * *
Parameters
mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),: * PHP DateTime object, or a standard date string * @param int $adjustmentMonths The number of months before or after start_date. * A positive value for months yields a future date; * a negative value yields a past date. * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag
2 calls to PHPExcel_Calculation_DateTime::EOMONTH()
- DateTimeTest::testEOMONTHtoPHP in vendor/
phpoffice/ phpexcel/ unitTests/ Classes/ PHPExcel/ Calculation/ DateTimeTest.php - DateTimeTest::testEOMONTHtoPHPObject in vendor/
phpoffice/ phpexcel/ unitTests/ Classes/ PHPExcel/ Calculation/ DateTimeTest.php
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ DateTime.php, line 1455
Class
- PHPExcel_Calculation_DateTime
- PHPExcel_Calculation_DateTime
Code
public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) {
$dateValue = PHPExcel_Calculation_Functions::flattenSingleValue($dateValue);
$adjustmentMonths = PHPExcel_Calculation_Functions::flattenSingleValue($adjustmentMonths);
if (!is_numeric($adjustmentMonths)) {
return PHPExcel_Calculation_Functions::VALUE();
}
$adjustmentMonths = floor($adjustmentMonths);
if (is_string($dateValue = self::_getDateValue($dateValue))) {
return PHPExcel_Calculation_Functions::VALUE();
}
// Execute function
$PHPDateObject = self::_adjustDateByMonths($dateValue, $adjustmentMonths + 1);
$adjustDays = (int) $PHPDateObject
->format('d');
$adjustDaysString = '-' . $adjustDays . ' days';
$PHPDateObject
->modify($adjustDaysString);
switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
return (double) PHPExcel_Shared_Date::PHPToExcel($PHPDateObject);
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
return (int) PHPExcel_Shared_Date::ExcelToPHP(PHPExcel_Shared_Date::PHPToExcel($PHPDateObject));
case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
return $PHPDateObject;
}
}