Search code examples
extjsextjs4asp.net-web-api

ASP.NET Web API Date Serialization


I have a Web API method that returns an object with a BirthDate Property.

In Fiddler, the web method json respose of the BirthDate is:

"BirthDate": "2006-08-04T00:00:00Z"

But in my ExtJS 4.2 DateField I have:

enter image description here

So I guess, the browser (Chrome) is substracting the TimeZone and thats why I dont see in the DateField 08/04/2006.

Any clue on how to solve this?


Solution

  • How are you returning the BirthDate property, as a DateTime or as a formatted string? You could try formatting the date portion of your DateTime in your code to a UTC string and return that. Then you won't have to worry about time or timezones.