-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Date datatype converts date => datetime #262
Comments
Hi Scott Running your code I get different results. The value is showing as a date with no time in both Excel... Dates are actually stored as numbers in excel, whole ones for date only values, with fractions added for times. To check what is actually being recorded in your workbook object, try adding the following code to your test case:
This is what I'm seeing, i.e. definitely a whole number, no time fractions: What do you get? |
I would assume this is a lucee issue and not a library issue correct? |
I'm not sure it's necessarily either, although it's complicated and adding timezones into the mix makes it more so! I'm not an expert in this, but here's my current partial understanding. The cell types the library lets you specify are
The library will however try to identify "date only" and "time only" values and set the cell format to only display those portions of the datetime value in the cell. But the underlying datetime value is still stored in Excel as a number as explained above. I don't fully understand the effect of changing the Lucee timezone, but I believe that POI/Excel uses the local machine timezone, so if there is a mismatch that will affect what POI stores. Apparently POI does provide a way of specifying the timezone. I'll have a look at whether that could be a potential solution. |
Forcing POI to match the Lucee timezone when setting date values does seem to fix the issue according to my tests. Please check with the latest develop branch, Scott, and if it's still not working for you just re-open the ticket. |
Reproducible use case
You can see that before it was a date with no time. after setting the datatype, the date now has a time of 7:00:00 AM
The text was updated successfully, but these errors were encountered: