c# - Json.NET deserialization on DateTime - not the right time(-6 hour) -


My application is the client and server-client and server exchange Jesan data the same client and server (4) This data category < / p>

  public domain MyData (); time zone {; Set; Start Public Date Time {get}}    server, I select data from the database MS SQL and give the client. When I start off deserialized on the client data field is off-6 hours. How do I get the right time? Can I get the right time using the JsonSerializer settings on the client? I tried  
  var jsonSerializerSettings = new JsonSerializerSettings () {DateFormatHandling = DateFormatHandling.MicrosoftDateFormat, DateParseHandling = DateParseHandling.DateTimeOffset, DateTimeZoneHandling = DateTimeZoneHandling.Local}; Var result = JsonConvert.DeserializeObject & lt; MyData & gt; (Content, jsonSerializer settings);   

But it gives offset of +3 I need offset +6.

datetime converted

serialization for UTC.

try something like this: deserialziation you need to change it

  var dateWithLocalTimeZone = myDate.ToLocalTime ();    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -