Convert DateTime to long and also the other way around

前端 未结 7 843
遥遥无期
遥遥无期 2020-12-05 09:29

I want to store dates as numbers in a table. I know how to do that but I don\'t know how to go back. How can I cast a long variable to ToDateTime.

DateTime n         


        
7条回答
  •  时光取名叫无心
    2020-12-05 09:59

    There are several possibilities (note that the those long values aren't the same as the Unix epoch.

    For your example (to reverse ToFileTime()) just use DateTime.FromFileTime(t).

提交回复
热议问题