我有以下问题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