【发布时间】:2017-07-20 09:17:23
【问题描述】:
我有以下问题
我正在使用 RestSharp 访问我的 API。但是当我发送 DateTime 时,它似乎被转换为 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"
}
知道我能做什么吗? 谢谢
【问题讨论】: