Split PHPToExcel logic for different input types

This commit is contained in:
MarkBaker 2016-08-14 22:36:30 +01:00
parent aa97bb3e45
commit 91573b5c93
12 changed files with 215 additions and 158 deletions

View File

@ -209,41 +209,57 @@ class Date
->format('U'); ->format('U');
} }
/** /**
* Convert a date from PHP to Excel * Convert a date from PHP to an MS Excel serialized date/time value
* *
* @param mixed $dateValue PHP serialized date/time or date object * @param mixed $dateValue PHP serialized date/time or date object
* @param boolean $adjustToTimezone Flag indicating whether $dateValue should be treated as * @return float|boolean Excel date/time value
* a UST timestamp, or adjusted to UST * or boolean FALSE on failure
* @param string $timezone The timezone for finding the adjustment from UST
* @return mixed Excel date/time value
* or boolean FALSE on failure
*/ */
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null) public static function PHPToExcel($dateValue = 0)
{ {
$saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$timezoneAdjustment = ($adjustToTimezone) ?
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone ? $timezone : $saveTimeZone, $dateValue) :
0;
$retValue = false;
if ((is_object($dateValue)) && ($dateValue instanceof \DateTimeInterface)) { if ((is_object($dateValue)) && ($dateValue instanceof \DateTimeInterface)) {
$dateValue->add(new \DateInterval('PT' . $timezoneAdjustment . 'S')); return self::DateTimeToExcel($dateValue);
$retValue = self::formattedPHPToExcel($dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s'));
} elseif (is_numeric($dateValue)) { } elseif (is_numeric($dateValue)) {
$dateValue += $timezoneAdjustment; return self::TimestampToExcel($dateValue);
$retValue = self::formattedPHPToExcel(date('Y', $dateValue), date('m', $dateValue), date('d', $dateValue), date('H', $dateValue), date('i', $dateValue), date('s', $dateValue));
} elseif (is_string($dateValue)) { } elseif (is_string($dateValue)) {
$retValue = self::stringToExcel($dateValue); return self::stringToExcel($dateValue);
} }
date_default_timezone_set($saveTimeZone);
return $retValue; return false;
} }
/**
* Convert a DateTime object to an MS Excel serialized date/time value
*
* @param \DateTimeInterface $dateValue PHP DateTime object
* @return float MS Excel serialized date/time value
*/
public static function dateTimeToExcel(\DateTimeInterface $dateValue = null)
{
return self::formattedPHPToExcel(
$dateValue->format('Y'),
$dateValue->format('m'),
$dateValue->format('d'),
$dateValue->format('H'),
$dateValue->format('i'),
$dateValue->format('s')
);
}
/**
* Convert a Unix timestamp to an MS Excel serialized date/time value
*
* @param \DateTimeInterface $dateValue PHP DateTime object
* @return float MS Excel serialized date/time value
*/
public static function timestampToExcel($dateValue = 0)
{
if (!is_numeric($dateValue)) {
return false;
}
return self::DateTimeToExcel(new \DateTime('@' . $dateValue));
}
/** /**
* formattedPHPToExcel * formattedPHPToExcel

View File

@ -48,9 +48,9 @@ class DateTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @dataProvider providerDateTimePHPToExcel1900 * @dataProvider providerDateTimeTimestampToExcel1900
*/ */
public function testDateTimePHPToExcel1900() public function testDateTimeTimestampToExcel1900()
{ {
$result = call_user_func( $result = call_user_func(
array(Date::class,'setExcelCalendar'), array(Date::class,'setExcelCalendar'),
@ -59,13 +59,34 @@ class DateTest extends \PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array(Date::class,'PHPToExcel'), $args); $result = call_user_func_array(array(Date::class,'timestampToExcel'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimePHPToExcel1900() public function providerDateTimeTimestampToExcel1900()
{ {
return include 'rawTestData/Shared/Date/PHPToExcel1900.php'; return include 'rawTestData/Shared/Date/TimestampToExcel1900.php';
}
/**
* @dataProvider providerDateTimeDateTimeToExcel
*/
public function testDateTimeDateTimeToExcel()
{
$result = call_user_func(
array(Date::class,'setExcelCalendar'),
Date::CALENDAR_WINDOWS_1900
);
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array(Date::class,'dateTimeToExcel'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-5);
}
public function providerDateTimeDateTimeToExcel()
{
return include 'rawTestData/Shared/Date/DateTimeToExcel.php';
} }
/** /**
@ -111,9 +132,9 @@ class DateTest extends \PHPUnit_Framework_TestCase
} }
/** /**
* @dataProvider providerDateTimePHPToExcel1904 * @dataProvider providerDateTimeTimestampToExcel1904
*/ */
public function testDateTimePHPToExcel1904() public function testDateTimeTimestampToExcel1904()
{ {
$result = call_user_func( $result = call_user_func(
array(Date::class,'setExcelCalendar'), array(Date::class,'setExcelCalendar'),
@ -122,13 +143,13 @@ class DateTest extends \PHPUnit_Framework_TestCase
$args = func_get_args(); $args = func_get_args();
$expectedResult = array_pop($args); $expectedResult = array_pop($args);
$result = call_user_func_array(array(Date::class,'PHPToExcel'), $args); $result = call_user_func_array(array(Date::class,'timestampToExcel'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-5); $this->assertEquals($expectedResult, $result, null, 1E-5);
} }
public function providerDateTimePHPToExcel1904() public function providerDateTimeTimestampToExcel1904()
{ {
return include 'rawTestData/Shared/Date/PHPToExcel1904.php'; return include 'rawTestData/Shared/Date/TimestampToExcel1904.php';
} }
/** /**

View File

@ -0,0 +1,20 @@
<?php
// DateTime object Result Comments
return [
[ new DateTime('1900-01-01'), 1.0 ], // Excel 1900 base calendar date
[ new DateTime('1900-02-28'), 59.0 ], // This and next test show gap for the mythical
[ new DateTime('1900-03-01'), 61.0 ], // MS Excel 1900 Leap Year
[ new DateTime('1901-12-14'), 714.0 ], // Unix Timestamp 32-bit Earliest Date
[ new DateTime('1903-12-31'), 1461.0 ],
[ new DateTime('1904-01-01'), 1462.0 ], // Excel 1904 Calendar Base Date
[ new DateTime('1904-01-02'), 1463.0 ],
[ new DateTime('1960-12-19'), 22269.0 ],
[ new DateTime('1970-01-01'), 25569.0 ], // Unix Timestamp Base Date
[ new DateTime('1982-12-07'), 30292.0 ],
[ new DateTime('2008-06-12'), 39611.0 ],
[ new DateTime('2038-01-19'), 50424.0 ], // Unix Timestamp 32-bit Latest Date
[ new DateTime('1903-05-18 13:37:46'), 1234.56789 ],
[ new DateTime('1933-10-18 16:17:37'), 12345.6789 ],
[ new DateTime('2099-12-31'), 73050.0 ],
];

View File

@ -1,19 +1,19 @@
<?php <?php
// Excel DateTimeStamp Result Comments // Excel DateTimeStamp Result Comments
return [ return [
[ 714, -2147472000 ], // PHP 32-bit Earliest Date 14-Dec-1901 [ 714, -2147472000 ], // PHP 32-bit Earliest Date 14-Dec-1901
[ 1461, -2082931200 ], // 31-Dec-1903 [ 1461, -2082931200 ], // 31-Dec-1903
[ 1462, -2082844800 ], // Excel 1904 Calendar Base Date 01-Jan-1904 [ 1462, -2082844800 ], // Excel 1904 Calendar Base Date 01-Jan-1904
[ 1463, -2082758400 ], // 02-Jan-1904 [ 1463, -2082758400 ], // 02-Jan-1904
[ 22269, -285120000 ], // 19-Dec-1960 [ 22269, -285120000 ], // 19-Dec-1960
[ 25569, 0 ], // PHP Base Date 01-Jan-1970 [ 25569, 0 ], // PHP Base Date 01-Jan-1970
[ 30292, 408067200 ], // 07-Dec-1982 [ 30292, 408067200 ], // 07-Dec-1982
[ 39611, 1213228800 ], // 12-Jun-2008 [ 39611, 1213228800 ], // 12-Jun-2008
[ 50424, 2147472000 ], // PHP 32-bit Latest Date 19-Jan-2038 [ 50424, 2147472000 ], // PHP 32-bit Latest Date 19-Jan-2038
[ 1234.56789, -2102494934 ], // 18-May-1903 13:37:46 [ 1234.56789, -2102494934 ], // 18-May-1903 13:37:46
[ 12345.6789, -1142494943 ], // 18-Oct-1933 16:17:37 [ 12345.6789, -1142494943 ], // 18-Oct-1933 16:17:37
[ 0.5, 43200 ], // 12:00:00 [ 0.5, 43200 ], // 12:00:00
[ 0.75, 64800 ], // 18:00.00 [ 0.75, 64800 ], // 18:00.00
[ 0.12345, 10666 ], // 02:57:46 [ 0.12345, 10666 ], // 02:57:46
]; ];

View File

@ -1,27 +1,27 @@
<?php <?php
// Excel DateTimeStamp Timezone Result Comments // Excel DateTimeStamp Timezone Result Comments
return [ return [
[ 22269, 'America/New_York', -285102000 ], // 19-Dec-1960 00:00:00 EST => 19-Dec-1960 05:00:00 UTC [ 22269, 'America/New_York', -285102000 ], // 19-Dec-1960 00:00:00 EST => 19-Dec-1960 05:00:00 UTC
[ 25569, 'America/New_York', 18000 ], // 01-Jan-1970 00:00:00 EST => 01-Jan-1970 05:00:00 UTC PHP Base Date [ 25569, 'America/New_York', 18000 ], // 01-Jan-1970 00:00:00 EST => 01-Jan-1970 05:00:00 UTC PHP Base Date
[ 30292, 'America/New_York', 408085200 ], // 07-Dec-1982 00:00:00 EST => 07-Dec-1982 05:00:00 UTC [ 30292, 'America/New_York', 408085200 ], // 07-Dec-1982 00:00:00 EST => 07-Dec-1982 05:00:00 UTC
[ 39611, 'America/New_York', 1213243200 ], // 12-Jun-2008 00:00:00 EDT => 12-Jun-2008 04:00:00 UTC [ 39611, 'America/New_York', 1213243200 ], // 12-Jun-2008 00:00:00 EDT => 12-Jun-2008 04:00:00 UTC
[ 50424, 'America/New_York', 2147490000 ], // 19-Jan-2038 00:00:00 EST => 19-Jan-2038 05:00:00 UTC PHP 32-bit Latest Date [ 50424, 'America/New_York', 2147490000 ], // 19-Jan-2038 00:00:00 EST => 19-Jan-2038 05:00:00 UTC PHP 32-bit Latest Date
[ 22345.56789, 'America/New_York', -278486534 ], // 05-Mar-1961 13:37:46 EST => 05-Mar-1961 18:37:46 UTC [ 22345.56789, 'America/New_York', -278486534 ], // 05-Mar-1961 13:37:46 EST => 05-Mar-1961 18:37:46 UTC
[ 22345.6789, 'America/New_York', -278476943 ], // 05-Mar-1961 16:17:37 EST => 05-Mar-1961 21:17:37 UTC [ 22345.6789, 'America/New_York', -278476943 ], // 05-Mar-1961 16:17:37 EST => 05-Mar-1961 21:17:37 UTC
[ 0.5, 'America/New_York', 61200 ], // 12:00:00 EST => 17:00:00 UTC [ 0.5, 'America/New_York', 61200 ], // 12:00:00 EST => 17:00:00 UTC
[ 0.75, 'America/New_York', 82800 ], // 18:00.00 EST => 23:00:00 UTC [ 0.75, 'America/New_York', 82800 ], // 18:00.00 EST => 23:00:00 UTC
[ 0.12345, 'America/New_York', 28666 ], // 02:57:46 EST => 07:57:46 UTC [ 0.12345, 'America/New_York', 28666 ], // 02:57:46 EST => 07:57:46 UTC
[ 41215, 'America/New_York', 1351828800 ], // 02-Nov-2012 00:00:00 EDT => 02-Nov-2012 04:00:00 UTC [ 41215, 'America/New_York', 1351828800 ], // 02-Nov-2012 00:00:00 EDT => 02-Nov-2012 04:00:00 UTC
[ 22269, 'Pacific/Auckland', -285163200 ], // 19-Dec-1960 00:00:00 NZST => 18-Dec-1960 12:00:00 UTC [ 22269, 'Pacific/Auckland', -285163200 ], // 19-Dec-1960 00:00:00 NZST => 18-Dec-1960 12:00:00 UTC
[ 25569, 'Pacific/Auckland', -43200 ], // 01-Jan-1970 00:00:00 NZST => 31-Dec-1969 12:00:00 UTC PHP Base Date [ 25569, 'Pacific/Auckland', -43200 ], // 01-Jan-1970 00:00:00 NZST => 31-Dec-1969 12:00:00 UTC PHP Base Date
[ 30292, 'Pacific/Auckland', 408020400 ], // 07-Dec-1982 00:00:00 NZDT => 06-Dec-1982 11:00:00 UTC [ 30292, 'Pacific/Auckland', 408020400 ], // 07-Dec-1982 00:00:00 NZDT => 06-Dec-1982 11:00:00 UTC
[ 39611, 'Pacific/Auckland', 1213185600 ], // 12-Jun-2008 00:00:00 NZST => 11-Jun-2008 12:00:00 UTC [ 39611, 'Pacific/Auckland', 1213185600 ], // 12-Jun-2008 00:00:00 NZST => 11-Jun-2008 12:00:00 UTC
[ 50423.5, 'Pacific/Auckland', 2147382000 ], // 18-Jan-2038 12:00:00 NZDT => 17-Jan-2038 23:00:00 UTC PHP 32-bit Latest Date [ 50423.5, 'Pacific/Auckland', 2147382000 ], // 18-Jan-2038 12:00:00 NZDT => 17-Jan-2038 23:00:00 UTC PHP 32-bit Latest Date
[ 22345.56789, 'Pacific/Auckland', -278547734 ], // 05-Mar-1961 13:37:46 NZST => 05-Mar-1961 01:37:46 UTC [ 22345.56789, 'Pacific/Auckland', -278547734 ], // 05-Mar-1961 13:37:46 NZST => 05-Mar-1961 01:37:46 UTC
[ 22345.6789, 'Pacific/Auckland', -278538143 ], // 05-Mar-1961 16:17:37 NZST => 05-Mar-1961 04:17:37 UTC [ 22345.6789, 'Pacific/Auckland', -278538143 ], // 05-Mar-1961 16:17:37 NZST => 05-Mar-1961 04:17:37 UTC
[ 0.5, 'Pacific/Auckland', 0 ], // 12:00:00 NZST => 00:00:00 UTC [ 0.5, 'Pacific/Auckland', 0 ], // 12:00:00 NZST => 00:00:00 UTC
[ 0.75, 'Pacific/Auckland', 21600 ], // 18:00.00 NZST => 06:00:00 UTC [ 0.75, 'Pacific/Auckland', 21600 ], // 18:00.00 NZST => 06:00:00 UTC
[ 0.12345, 'Pacific/Auckland', -32534 ], // 02:57:46 NZST => 14:57:46 UTC [ 0.12345, 'Pacific/Auckland', -32534 ], // 02:57:46 NZST => 14:57:46 UTC
[ 41215, 'Pacific/Auckland', 1351767600 ], // 02-Nov-2012 00:00:00 NZDT => 01-Nov-2012 11:00:00 UTC [ 41215, 'Pacific/Auckland', 1351767600 ], // 02-Nov-2012 00:00:00 NZDT => 01-Nov-2012 11:00:00 UTC
]; ];

View File

@ -1,14 +1,14 @@
<?php <?php
// Excel DateTimeStamp Result Comments // Excel DateTimeStamp Result Comments
return [ return [
[ 1462, -1956528000 ], [ 1462, -1956528000 ],
[ 1463, -1956441600 ], [ 1463, -1956441600 ],
[ 22269, -158803200 ], [ 22269, -158803200 ],
[ 25569, 126316800 ], [ 25569, 126316800 ],
[ 30292, 534384000 ], [ 30292, 534384000 ],
[ 39611, 1339545600 ], [ 39611, 1339545600 ],
[ 0.25, 21600 ], // 06:00:00 [ 0.25, 21600 ], // 06:00:00
[ 0.3333333333333333333, 28800 ], // 08:00.00 [ 0.3333333333333333333, 28800 ], // 08:00.00
[ 0.54321, 46933 ], // 02:57:46 [ 0.54321, 46933 ], // 02:57:46
]; ];

View File

@ -1,41 +1,41 @@
<?php <?php
// Excel Format Code Result // Excel Format Code Result
return [ return [
[ 'General', FALSE ], [ 'General', FALSE ],
[ '@', FALSE ], [ '@', FALSE ],
[ '0', FALSE ], [ '0', FALSE ],
[ '0.00', FALSE ], [ '0.00', FALSE ],
[ '#,##0.00', FALSE ], [ '#,##0.00', FALSE ],
[ '#,##0.00_-', FALSE ], [ '#,##0.00_-', FALSE ],
[ '0%', FALSE ], [ '0%', FALSE ],
[ '0.00%', FALSE ], [ '0.00%', FALSE ],
[ 'yyyy-mm-dd', TRUE ], [ 'yyyy-mm-dd', TRUE ],
[ 'yy-mm-dd', TRUE ], [ 'yy-mm-dd', TRUE ],
[ 'dd/mm/yy', TRUE ], [ 'dd/mm/yy', TRUE ],
[ 'd/m/y', TRUE ], [ 'd/m/y', TRUE ],
[ 'd-m-y', TRUE ], [ 'd-m-y', TRUE ],
[ 'd-m', TRUE ], [ 'd-m', TRUE ],
[ 'm-y', TRUE ], [ 'm-y', TRUE ],
[ 'mm-dd-yy', TRUE ], [ 'mm-dd-yy', TRUE ],
[ 'd-mmm-yy', TRUE ], [ 'd-mmm-yy', TRUE ],
[ 'd-mmm', TRUE ], [ 'd-mmm', TRUE ],
[ 'mmm-yy', TRUE ], [ 'mmm-yy', TRUE ],
[ 'm/d/yy h:mm', TRUE ], [ 'm/d/yy h:mm', TRUE ],
[ 'd/m/y h:mm', TRUE ], [ 'd/m/y h:mm', TRUE ],
[ 'h:mm AM/PM', TRUE ], [ 'h:mm AM/PM', TRUE ],
[ 'h:mm:ss AM/PM', TRUE ], [ 'h:mm:ss AM/PM', TRUE ],
[ 'h:mm', TRUE ], [ 'h:mm', TRUE ],
[ 'h:mm:ss', TRUE ], [ 'h:mm:ss', TRUE ],
[ 'mm:ss', TRUE ], [ 'mm:ss', TRUE ],
[ 'h:mm:ss', TRUE ], [ 'h:mm:ss', TRUE ],
[ 'i:s.S', TRUE ], [ 'i:s.S', TRUE ],
[ 'h:mm:ss;@', TRUE ], [ 'h:mm:ss;@', TRUE ],
[ 'yy/mm/dd;@', TRUE ], [ 'yy/mm/dd;@', TRUE ],
[ '"$" #,##0.00_-', FALSE ], [ '"$" #,##0.00_-', FALSE ],
[ '$#,##0_-', FALSE ], [ '$#,##0_-', FALSE ],
[ '[$EUR ]#,##0.00_-', FALSE ], [ '[$EUR ]#,##0.00_-', FALSE ],
[ '_[$EUR ]#,##0.00_-', FALSE ], [ '_[$EUR ]#,##0.00_-', FALSE ],
[ '[Green]#,##0.00;[Red]#,##0.00_-', FALSE ], [ '[Green]#,##0.00;[Red]#,##0.00_-', FALSE ],
[ '#,##0.00 "dollars"', FALSE ], [ '#,##0.00 "dollars"', FALSE ],
]; ];

View File

@ -1,16 +1,16 @@
<?php <?php
// Year Month Day Hours Minutes Seconds Result Comments // Year Month Day Hours Minutes Seconds Result Comments
return [ return [
[ 1901, 12, 14, 714 ], // PHP 32-bit Earliest Date 14-Dec-1901 [ 1901, 12, 14, 714 ], // PHP 32-bit Earliest Date 14-Dec-1901
[ 1903, 12, 31, 1461 ], // 31-Dec-1903 [ 1903, 12, 31, 1461 ], // 31-Dec-1903
[ 1904, 1, 1, 1462 ], // Excel 1904 Calendar Base Date 01-Jan-1904 [ 1904, 1, 1, 1462 ], // Excel 1904 Calendar Base Date 01-Jan-1904
[ 1904, 1, 2, 1463 ], // 02-Jan-1904 [ 1904, 1, 2, 1463 ], // 02-Jan-1904
[ 1960, 12, 19, 22269 ], // 19-Dec-1960 [ 1960, 12, 19, 22269 ], // 19-Dec-1960
[ 1970, 1, 1, 25569 ], // PHP Base Date 01-Jan-1970 [ 1970, 1, 1, 25569 ], // PHP Base Date 01-Jan-1970
[ 1982, 12, 7, 30292 ], // 07-Dec-1982 [ 1982, 12, 7, 30292 ], // 07-Dec-1982
[ 2008, 6, 12, 39611 ], // 12-Jun-2008 [ 2008, 6, 12, 39611 ], // 12-Jun-2008
[ 2038, 1, 19, 50424 ], // PHP 32-bit Latest Date 19-Jan-2038 [ 2038, 1, 19, 50424 ], // PHP 32-bit Latest Date 19-Jan-2038
[ 1903, 5, 18, 13, 37, 46, 1234.56789 ], // 18-May-1903 13:37:46 [ 1903, 5, 18, 13, 37, 46, 1234.56789 ], // 18-May-1903 13:37:46
[ 1933, 10, 18, 16, 17, 37, 12345.6789 ], // 18-Oct-1933 16:17:37 [ 1933, 10, 18, 16, 17, 37, 12345.6789 ], // 18-Oct-1933 16:17:37
]; ];

View File

@ -1,16 +0,0 @@
<?php
// Excel DateTimeStamp Result Comments
return [
[ -2147472000, 714 ], // PHP 32-bit Earliest Date 14-Dec-1901
[ -2082931200, 1461 ], // 31-Dec-1903
[ -2082844800, 1462 ], // Excel 1904 Calendar Base Date 01-Jan-1904
[ -2082758400, 1463 ], // 02-Jan-1904
[ -285120000, 22269 ], // 19-Dec-1960
[ 0, 25569 ], // PHP Base Date 01-Jan-1970
[ 408067200, 30292 ], // 07-Dec-1982
[ 1213228800, 39611 ], // 12-Jun-2008
[ 2147472000, 50424 ], // PHP 32-bit Latest Date 19-Jan-2038
[ -2102494934, 1234.56789 ], // 18-May-1903 13:37:46
[ -1142494943, 12345.6789 ], // 18-Oct-1933 16:17:37
];

View File

@ -1,11 +0,0 @@
<?php
// Excel DateTimeStamp Result
return [
[ -1956528000, 1462 ],
[ -1956441600, 1463 ],
[ -158803200, 22269 ],
[ 126316800, 25569 ],
[ 534384000, 30292 ],
[ 1339545600, 39611 ],
];

View File

@ -0,0 +1,16 @@
<?php
// Unix TimeStamp Result Comments
return [
[ -2147472000, 714 ], // PHP 32-bit Earliest Date 14-Dec-1901
[ -2082931200, 1461 ], // 31-Dec-1903
[ -2082844800, 1462 ], // Excel 1904 Calendar Base Date 01-Jan-1904
[ -2082758400, 1463 ], // 02-Jan-1904
[ -285120000, 22269 ], // 19-Dec-1960
[ 0, 25569 ], // PHP Base Date 01-Jan-1970
[ 408067200, 30292 ], // 07-Dec-1982
[ 1213228800, 39611 ], // 12-Jun-2008
[ 2147472000, 50424 ], // PHP 32-bit Latest Date 19-Jan-2038
[ -2102494934, 1234.56789 ], // 18-May-1903 13:37:46
[ -1142494943, 12345.6789 ], // 18-Oct-1933 16:17:37
];

View File

@ -0,0 +1,11 @@
<?php
// Excel DateTimeStamp Result
return [
[ -1956528000, 1462 ],
[ -1956441600, 1463 ],
[ -158803200, 22269 ],
[ 126316800, 25569 ],
[ 534384000, 30292 ],
[ 1339545600, 39611 ],
];