<?php
//function correct_date_format( $parms ){
//$date = DateTime::createFromFormat( 'm/d/Y' , $parms[3] );
//$date_val = $date->format('d-m-Y');
// $EXCEL_DATE = $parms[3];
// $UNIX_DATE = ($EXCEL_DATE - 25569) * 86400;
// $date = gmdate("d-m-Y H:i:s", $UNIX_DATE);
$dateTime = ExcelToPHP(44320);
$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;
//$pod = pods( $parms[1], $parms[2] )->add($parms[0], $dateObj );
//}
function ExcelToPHP($dateValue = 0) {
if (self::$ExcelBaseDate == self::CALENDAR_WINDOWS_1900) {
$myExcelBaseDate = 25569;
// Adjust for the spurious 29-Feb-1900 (Day 60)
if ($dateValue < 60) {
--$myExcelBaseDate;
}
} else {
$myExcelBaseDate = 24107;
}
// Perform conversion
if ($dateValue >= 1) {
$utcDays = $dateValue - $myExcelBaseDate;
$returnValue = round($utcDays * 86400);
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
$returnValue = (integer) $returnValue;
}
} else {
$hours = round($dateValue * 24);
$mins = round($dateValue * 1440) - round($hours * 60);
$secs = round($dateValue * 86400) - round($hours * 3600) - round($mins * 60);
$returnValue = (integer) gmmktime($hours, $mins, $secs);
}
// Return
return $returnValue;
} // function ExcelToPHP()
- Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.40, 5.5.24, 5.6.7 - 5.6.8
- Fatal error: Cannot access self:: when no class scope is active in /in/ppbm9 on line 23
Process exited with code 255. - Output for 5.1.0
- Fatal error: fatal flex scanner internal error--end of buffer missed in /in/ppbm9 on line 49
Process exited with code 255. - Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected T_IS_EQUAL, expecting '(' in /in/ppbm9 on line 23
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
- Parse error: parse error, unexpected T_IS_EQUAL, expecting '(' in /in/ppbm9 on line 23
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `'('' in /in/ppbm9 on line 23
Process exited with code 255.
preferences:
229.72 ms | 1395 KiB | 133 Q