Conversion from milliseconds to DateTime format

后端 未结 3 955
面向向阳花
面向向阳花 2020-12-01 09:00

I got a string which is representend like this :

string startdatetime = \"13988110600000\"

What I want to do is to convert this string (wh

3条回答
  •  悲哀的现实
    2020-12-01 09:59

    Since TimeSpan.Ticks property returns long, your new DateTime(time.Ticks) code call DateTime(long) constructor and from it's documentation;

    A date and time expressed in the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00.000 in the Gregorian calendar.

    That's why it's wrong to say The result is almost good. The value of result is expected as implemented and documented.

提交回复
热议问题