How to convert a double value to a DateTime in c#?

后端 未结 5 1424
-上瘾入骨i
-上瘾入骨i 2021-01-01 23:33

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

5条回答
  •  一整个雨季
    2021-01-01 23:54

    Try something like this:-

    double d = 40880.051388 ;
    DateTime dt = DateTime.FromOADate(d);
    

提交回复
热议问题