I have the value 40880.051388 and am storing it as a double, if I open Excel and paste in a cell and apply the following custom format "m/d/yyyy h:mm"
to that cell, I get "12/3/2011 1:14"
How can I do this parsing/Conversion in C#? I don't know if the value is milliseconds from a certain checkpoint, like epoch time, or if the value is in some specific prepared format, but how does excel come up with this particular value? Can it be done in C#?
I've tried working with TimeSpan
, DateTime
, and other like things in Visual Studio but am not getting anywhere.
Looks like you're using the old OLE Automation date. Use
DateTime.FromOADate(myDouble)
Try something like this:-
double d = 40880.051388 ;
DateTime dt = DateTime.FromOADate(d);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With