You are here

public static function PHPExcel_Shared_Date::PHPToExcel in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Date.php \PHPExcel_Shared_Date::PHPToExcel()

* Convert a date from PHP to Excel * *

Parameters

mixed $dateValue PHP serialized date/time or date object: * @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as * a UST timestamp, or adjusted to UST * @param string $timezone The timezone for finding the adjustment from UST * @return mixed Excel date/time value * or boolean FALSE on failure

13 calls to PHPExcel_Shared_Date::PHPToExcel()
02types-xls.php in vendor/phpoffice/phpexcel/Examples/02types-xls.php
02types.php in vendor/phpoffice/phpexcel/Examples/02types.php
05featuredemo.inc.php in vendor/phpoffice/phpexcel/Examples/05featuredemo.inc.php
30template.php in vendor/phpoffice/phpexcel/Examples/30template.php
PHPExcel_Calculation_DateTime::DATENOW in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* 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 *…

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Date.php, line 185

Class

PHPExcel_Shared_Date
PHPExcel_Shared_Date

Code

public static function PHPToExcel($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
  $saveTimeZone = date_default_timezone_get();
  date_default_timezone_set('UTC');
  $retValue = FALSE;
  if (is_object($dateValue) && $dateValue instanceof DateTime) {
    $retValue = self::FormattedPHPToExcel($dateValue
      ->format('Y'), $dateValue
      ->format('m'), $dateValue
      ->format('d'), $dateValue
      ->format('H'), $dateValue
      ->format('i'), $dateValue
      ->format('s'));
  }
  elseif (is_numeric($dateValue)) {
    $retValue = self::FormattedPHPToExcel(date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue), date('H', $dateValue), date('i', $dateValue), date('s', $dateValue));
  }
  date_default_timezone_set($saveTimeZone);
  return $retValue;
}