Excel Date field value differs from c# dateTime by 1 day while reading excel file with EEPlus

StackOverflow https://stackoverflow.com/questions/19915228

  •  30-07-2022
  •  | 
  •  

Question

I have a problem with getting correct date field value from excel (.xlsx) file with EEPlus library.

The particular problem is that in excel i have e.g. 1900.01.04, but in C# I get 1900.01.03.

I had an idea, that when I read date value from excel it (EEPlus) converts it to utc and I should convert it to local time zone, but as time values of date object are nil it's probably not the case.

var date = (DateTime) Worksheet.Cells[row, column].Value;

Thanks!

Was it helpful?

Solution

If the EEPlus date differs from the Excel date then it is probably a bug in EEPlus.

It is likely that it is accounting for the infamous Excel 1900 leap year bug but only for dates after February 29(!!) 1900.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top