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) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -