Best way to convert JavaScript date to .NET date

前端 未结 5 877
清歌不尽
清歌不尽 2021-02-05 11:20

I have a date in JavaScript and its value is coming like this

Fri Apr 01 2011 05:00:00 GMT+0530 (India Standard Time) {}

Now what is the best way to convert th

5条回答
  •  日久生厌
    2021-02-05 11:53

    Ok here try this simple function which will convert your `double' representation of your Unix Timestamp

    public static DateTime ConvertFromUnixTimestamp(double timestamp)
    {
        DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
        return origin.AddMilliseconds(timestamp); 
    }
    

提交回复
热议问题