我有以下問題RestSharp將日期時間轉換爲UTC
我正在使用RestSharp來訪問我的API。但是當我發送日期時間時,它似乎被轉換爲UTC。 我發送'10 .06.1991 00:00',API獲取'09 .06.1991 22:00'
因此,當我的API獲取DateTime對象時,我總是需要添加2個小時?
我檢查了JSON RestSharp發送到API。
public class Test
{
public int IntProperty {get;set;}
public string StringProperty {get;set;}
public DateTime DateTimeProperty {get;set;}
}
我的目標是
Test t = new Test{ IntProperty=3, StringProperty="string", DateTimeProperty=new DateTime(1991,06,10) }
,當我通過RestSharp發送對象,我的API接收JSON是
{
"IntProperty":3,
"StringProperty":"string",
"DateTimeProperty":"09.06.1991 22:00:00"
}
任何想法,我能做些什麼? 謝謝
這是同樣的問題,因爲https://github.com/restsharp/RestSharp/issues/691? – mjwills