问题描述
使用EEPlus库从excel(.xlsx)文件获取正确的日期字段值有问题。特别的问题是,在excel中我有例如1900.01.04,但在C#中我得到了1900.01.03。
我有一个想法,当我从excel读取日期值(EEPlus)将其转换为utc和我应该将其转换为当地时区,但是由于日期对象的时间值为零,可能不是这样。
var date =(DateTime)Worksheet.Cells [row,column] .Value;
谢谢!
如果EEPlus日期与Excel日期不同,那么它可能是EEPlus中的一个错误。
很可能它是,但只适用于2月29日(!!)1900之后的日期。
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!
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.
这篇关于Excel Date字段值与c#dateTime不同,同时使用EEPlus读取excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!