How do I convert from excel serial date to a .NET date time?
For example 39938 is 05/05/2009.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Where 39938 is the number of days since 1/1/1900?
In that case, use the framework library function
DateTime.FromOADate().This function encapsulates all the specifics, and does bounds checking.
For its historical value, here is a possible implementation:
(C#)
VB
[Update]:
Hmm… A quick test of that shows it’s actually two days off. Not sure where the difference is.
Okay: problem fixed now. See the comments for details.