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
  •  | 
  •  

Domanda

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!

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top