public static function PHPExcel_Shared_OLE::LocalDate2OLE in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE.php \PHPExcel_Shared_OLE::LocalDate2OLE()
* Utility function * Returns a string for the OLE container with the date given * * @access public * @static *
Parameters
integer $date A timestamp: * @return string The string for the OLE container
2 calls to PHPExcel_Shared_OLE::LocalDate2OLE()
- PHPExcel_Shared_OLE_PPS::_getPpsWk in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ OLE/ PPS.php - * Returns a string with the PPS's WK (What is a WK?) * * @access public *
- PHPExcel_Writer_Excel5::_writeSummaryInformation in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5.php - * Build the OLE Part for Summary Information *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ OLE.php, line 464
Class
- PHPExcel_Shared_OLE
- OLE package base class.
Code
public static function LocalDate2OLE($date = null) {
if (!isset($date)) {
return "\0\0\0\0\0\0\0\0";
}
// factor used for separating numbers into 4 bytes parts
$factor = pow(2, 32);
// days from 1-1-1601 until the beggining of UNIX era
$days = 134774;
// calculate seconds
$big_date = $days * 24 * 3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
// multiply just to make MS happy
$big_date *= 10000000;
$high_part = floor($big_date / $factor);
// lower 4 bytes
$low_part = floor(($big_date / $factor - $high_part) * $factor);
// Make HEX string
$res = '';
for ($i = 0; $i < 4; ++$i) {
$hex = $low_part % 0x100;
$res .= pack('c', $hex);
$low_part /= 0x100;
}
for ($i = 0; $i < 4; ++$i) {
$hex = $high_part % 0x100;
$res .= pack('c', $hex);
$high_part /= 0x100;
}
return $res;
}