You are here

public static function PHPExcel_Shared_Date::ExcelToPHP 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::ExcelToPHP()

* Convert a date from Excel to PHP * *

Parameters

long $dateValue Excel date/time value: * @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 long PHP serialized date/time

14 calls to PHPExcel_Shared_Date::ExcelToPHP()
PHPExcel_Calculation_DateTime::DATE in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* DATE * * The DATE function returns a value that represents a particular date. * * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date * format of your regional settings. PHPExcel does not change…
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 *…
PHPExcel_Calculation_DateTime::DATEVALUE in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* DATEVALUE * * Returns a value that represents a particular date. * Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp * value. * * NOTE: When used in a Cell Formula, MS Excel changes the cell…
PHPExcel_Calculation_DateTime::EDATE in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* EDATE * * Returns the serial number that represents the date that is the indicated number of months * before or after a specified date (the start_date). * Use EDATE to calculate maturity dates or due dates that fall on the same day of the…
PHPExcel_Calculation_DateTime::EOMONTH in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* 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. * *…

... See full list

File

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

Class

PHPExcel_Shared_Date
PHPExcel_Shared_Date

Code

public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
  if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
    $my_excelBaseDate = 25569;

    //	Adjust for the spurious 29-Feb-1900 (Day 60)
    if ($dateValue < 60) {
      --$my_excelBaseDate;
    }
  }
  else {
    $my_excelBaseDate = 24107;
  }

  // Perform conversion
  if ($dateValue >= 1) {
    $utcDays = $dateValue - $my_excelBaseDate;
    $returnValue = round($utcDays * 86400);
    if ($returnValue <= PHP_INT_MAX && $returnValue >= -PHP_INT_MAX) {
      $returnValue = (int) $returnValue;
    }
  }
  else {
    $hours = round($dateValue * 24);
    $mins = round($dateValue * 1440) - round($hours * 60);
    $secs = round($dateValue * 86400) - round($hours * 3600) - round($mins * 60);
    $returnValue = (int) gmmktime($hours, $mins, $secs);
  }
  $timezoneAdjustment = $adjustToTimezone ? PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) : 0;

  // Return
  return $returnValue + $timezoneAdjustment;
}