Passing UTC DateTime to Web API HttpGet Method results in local time

前端 未结 5 867
失恋的感觉
失恋的感觉 2020-12-02 15:39

I\'m trying to pass a UTC date as a query string parameter to a Web API method. The URL looks like

/api/order?endDate=2014-04-01T00:00:00Z&zoneId=4
         


        
5条回答
  •  臣服心动
    2020-12-02 16:04

    I finally find this code , it's not the main answer but it can be used in some cases :

    var dateUtc = TimeZoneInfo.ConvertTimeToUtc(date);
    

提交回复
热议问题