You are here

public static function PHPExcel_Calculation_DateTime::DATENOW 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::DATENOW()

* DATENOW * * Returns the current date. * The NOW function is useful when you need to display the current date and time on a worksheet or * calculate a value based on the current date and time, and have that value updated each time you * open the worksheet. * * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date * and time format of your regional settings. PHPExcel does not change cell formatting in this way. * * Excel Function: * TODAY() * * @access public * @category Date/Time Functions *

Return value

mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, * depending on the value of the ReturnDateType flag

1 call to PHPExcel_Calculation_DateTime::DATENOW()
PHPExcel_Worksheet_AutoFilter::_dynamicFilterDateRange in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/AutoFilter.php
* Convert a dynamic rule daterange to a custom filter range expression for ease of calculation * *

File

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

Class

PHPExcel_Calculation_DateTime
PHPExcel_Calculation_DateTime

Code

public static function DATENOW() {
  $saveTimeZone = date_default_timezone_get();
  date_default_timezone_set('UTC');
  $retValue = False;
  $excelDateTime = floor(PHPExcel_Shared_Date::PHPToExcel(time()));
  switch (PHPExcel_Calculation_Functions::getReturnDateType()) {
    case PHPExcel_Calculation_Functions::RETURNDATE_EXCEL:
      $retValue = (double) $excelDateTime;
      break;
    case PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC:
      $retValue = (int) PHPExcel_Shared_Date::ExcelToPHP($excelDateTime);
      break;
    case PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT:
      $retValue = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateTime);
      break;
  }
  date_default_timezone_set($saveTimeZone);
  return $retValue;
}