Re:Ask HN: What is something you do for clients that consist...
by mathw on Tuesday December 13, 2016 @03:27AM
(#13165387)
You've unleashed a flood of horrible memories of reading XLS and XLSX files with dates in. Thanks a bunch.
You'd think when Microsoft came up with their new shiny file formats they'd actually make them new and shiny and good.
But nope.
Excel encodes dates and times as floating point numbers. The date / time-ness of a cell is encoded in its format. Some of the formats are hard-coded, some float depending on locale, and some use explicit format-pictures embedded in the styles.
But of course there's no guarantee that the user has formatted a cell with a date as a date. Sometimes the user has pasted a US-format date into a copy of Excel running in a UK locale, so dates that fit have day and month swapped, while dates that don't fit show up as strings. This is non-trivial to handle in the general case. I've had to add customer-specific workarounds for this case in particular.