I have globally explicitly configured my MVC4 app to use the JSON.NET serializer . I know i have the choice of using the ISO standard dates or the old Microsoft date format
Change your setting set up code like this:
JsonMediaTypeFormatter jsonFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
JsonSerializerSettings jSettings = new Newtonsoft.Json.JsonSerializerSettings()
{
Formatting = Formatting.Indented,
DateTimeZoneHandling = DateTimeZoneHandling.Utc
};
jSettings.Converters.Add(new MyDateTimeConvertor());
jsonFormatter.SerializerSettings = jSettings;
In your code you are just changing local variable value.
Thanks, I was going crazy, this worked very well for me,paste this in the Global.asax.cs
JsonMediaTypeFormatter jsonFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
JsonSerializerSettings jSettings =...
create a class MyDateTimeConvertor, paste this in the class
public class MyDateTimeConvertor : DateTimeConverterBase
{
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return DateTime...
wep api mvc4, web services, custom date format.