You are here

public static function PHPExcel_Shared_OLE::OLE2LocalDate in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE.php \PHPExcel_Shared_OLE::OLE2LocalDate()

* Returns a timestamp from an OLE container's date * * @access public * @static *

Parameters

integer $string A binary string with the encoded date: * @return string The timestamp corresponding to the string

3 calls to PHPExcel_Shared_OLE::OLE2LocalDate()
PHPExcel_Reader_Excel5::_readDocumentSummaryInformation in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Read additional document summary information
PHPExcel_Reader_Excel5::_readSummaryInformation in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
* Read summary information
PHPExcel_Shared_OLE::_readPpsWks in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE.php
* Gets information about all PPS's on the OLE container from the PPS WK's * creates an OLE_PPS object for each one. * * @access public *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE.php, line 509

Class

PHPExcel_Shared_OLE
OLE package base class.

Code

public static function OLE2LocalDate($string) {
  if (strlen($string) != 8) {
    return new PEAR_Error("Expecting 8 byte string");
  }

  // factor used for separating numbers into 4 bytes parts
  $factor = pow(2, 32);
  list(, $high_part) = unpack('V', substr($string, 4, 4));
  list(, $low_part) = unpack('V', substr($string, 0, 4));
  $big_date = $high_part * $factor + $low_part;

  // translate to seconds
  $big_date /= 10000000;

  // days from 1-1-1601 until the beggining of UNIX era
  $days = 134774;

  // translate to seconds from beggining of UNIX era
  $big_date -= $days * 24 * 3600;
  return floor($big_date);
}