jivangilad
jivangilad

Reputation: 479

Mvc web api changes the JSON datetime due to UTC

I have date in javascript in the format Tue Sep 30 00:00:00 UTC+0200 2014 I send it with http post. On the controller in MVC Web Api I get 29/09/2014 22:00:00.

What is going on and how can I solve it?

Upvotes: 0

Views: 596

Answers (1)

jivangilad
jivangilad

Reputation: 479

I realize that the JSON formater of WebApi convert the date into UTC. therefor what I should do is return the date into local time of the server: TimeZone.CurrentTimeZon.ToLocalTime(dt). Confusing and it was hard to find the answer.

Upvotes: 1

Related Questions