Prev EEHelper class |
ExcelExplorer Manual |
Next CSSBorderStyle |
 |
(ExcelExplorer 4.0)
Convert number to a date using Excel algorithm.
array Number2Date( number $number [, boolean $date1904 = null] )
Parameters
- number $number
- Non-negative number (integer, float or numeric string) that will be converted to an Excel date.
- boolean $date1904
- If set to TRUE then convertion will be done on 1904-based date (usually used on Mac), if set to FALSE - 1900-based date system will be used. If omitted then settings from the Excel file will be used.
Description
Convert number to a date using Excel algorithm.
If optional parameter date1904 set to TRUE then convertion will be done using 1904-based date.
If optional parameter date1904 set to FALSE then convertion will be done using 1900-based date.
If optional parameter is omitted then convertion will be done using Excel file settings (if it explored before using this function) or using 1900-based date, if no Excel file have been readed before using this function.
This function returns FALSE if negative number used for convertion.
Otherwise it returns array containing date and time values in the following format:
['year'] - year, 4-digits number
['month'] - month, 1-12
['day'] - day of the month, 1-31
['hour'] - hour, 0-23
['min'] - minutes, 0-59
['sec'] - seconds, 0-59
['usec'] - microseconds, 0-999
Convert number to date
<?php
print_r($ee->Helper()->Number2Date(36458.64887534,false));
print_r($ee->Helper()->Number2Date(36458.64887534,true));
?>
Will output: Array
(
[year] => 1999
[month] => 10
[day] => 25
[hour] => 15
[min] => 34
[sec] => 22
[usec] => 829
)
Array
(
[year] => 2003
[month] => 10
[day] => 26
[hour] => 15
[min] => 34
[sec] => 22
[usec] => 829
)
|