You are here

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

* Convert a date from Excel to a PHP Date/Time object * *

Parameters

integer $dateValue Excel date/time value: * @return DateTime PHP date/time object

13 calls to PHPExcel_Shared_Date::ExcelToPHPObject()
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::DATEDIF in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* DATEDIF * *
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::DAYOFMONTH in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* DAYOFMONTH * * Returns the day of the month, for a specified date. The day is given as an integer * ranging from 1 to 31. * * Excel Function: * DAY(dateValue) * *
PHPExcel_Calculation_DateTime::DAYOFWEEK in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
* DAYOFWEEK * * Returns the day of the week for a specified date. The day is given as an integer * ranging from 0 to 7 (dependent on the requested style). * * Excel Function: * WEEKDAY(dateValue[,style]) * *

... See full list

File

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

Class

PHPExcel_Shared_Date
PHPExcel_Shared_Date

Code

public static function ExcelToPHPObject($dateValue = 0) {
  $dateTime = self::ExcelToPHP($dateValue);
  $days = floor($dateTime / 86400);
  $time = round(($dateTime / 86400 - $days) * 86400);
  $hours = round($time / 3600);
  $minutes = round($time / 60) - $hours * 60;
  $seconds = round($time) - $hours * 3600 - $minutes * 60;
  $dateObj = date_create('1-Jan-1970+' . $days . ' days');
  $dateObj
    ->setTime($hours, $minutes, $seconds);
  return $dateObj;
}