Best way to convert JavaScript date to .NET date

前端 未结 5 944
清歌不尽
清歌不尽 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:44

    Convert JavaScript into UTCString from Client side:

    var testDate = new Date().toUTCString();
    

    Parse it from C# code (you can fetch js date through webservice call).

    DateTime date = DateTime.Parse(testDate);
    

提交回复
热议问题