Skip to content

Get xls datetime as number #3525

Answered by MarkBaker
topmet asked this question in Q&A
Apr 17, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

You do realise that $reader->setReadDataOnly(true); is telling the Reader to load only the raw data from the worksheet, and not to load the formatting information for cells?

The value that looks like 01.03.2023 10:57:06 in the Excel cell is an Excel serialized timestamp, a numeric value (44986.456319444) with a number format mask that tells Excel to display it like a date.
When you do $reader->setReadDataOnly(true);, you're telling PhpSpreadsheet to load the value (44986.456319444), but not to load the number format mask.

See the documentation here

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@topmet
Comment options

Comment options

You must be logged in to vote
1 reply
@topmet
Comment options

Answer selected by topmet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants