Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeFormat in Excel 365 with only time as input #353

Open
TonHaver opened this issue Nov 26, 2023 · 1 comment
Open

TimeFormat in Excel 365 with only time as input #353

TonHaver opened this issue Nov 26, 2023 · 1 comment

Comments

@TonHaver
Copy link

Using ex02-formats.php the last 2 Dates columns were not presented as expexted in Excel 365 for Mac (16.71)
image
The value in those cells is : -693625,00001157

Opening the file in LibreOffice show expected presentation
image

Took me a while to find the cause. Excel can't cope with years < 1900 or > 9999
Therefore the class has a boundary check at lines 877-883 in function function convert_date_time

But if only a time as in custom-time1 and custom-time2 is given as $date_input, $day and $month and $year are 0, so $days is calculated as -693626

The easiest solution/workaround I could find, was to add this line after $seconds was calculated:
if ($day ==0) return $seconds;

@sayid
Copy link

sayid commented Nov 26, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants