RestSharp converts Datetimes to UTC

Viewed 6630

I have following problem

I'm using RestSharp for accessing my API. But when I'm sending a DateTime it seems to be converted to UTC. I'm sending '10.06.1991 00:00' and the API gets '09.06.1991 22:00'

So, I would always need to add 2 hours when my API gets a DateTime-object?

I checked the JSON RestSharp sends to the API.

public class Test
{
    public int IntProperty {get;set;}
    public string StringProperty {get;set;}
    public DateTime DateTimeProperty {get;set;}
}

My object is

Test t = new Test{ IntProperty=3, StringProperty="string", DateTimeProperty=new DateTime(1991,06,10) }

when I'm sending the object via RestSharp, the JSON my API receives is

{
    "IntProperty":3,
    "StringProperty":"string",
    "DateTimeProperty":"09.06.1991 22:00:00"
}

Any idea what I could do? Thanks

2 Answers
Related