Created
May 28, 2012 22:17
-
-
Save AlexZeitler/2821442 to your computer and use it in GitHub Desktop.
Custom datetime formatting with JSON.NET and ASP.NET Web API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = GlobalConfiguration.Configuration; | |
var settings = new JsonSerializerSettings(); | |
settings.Converters.Add(new IsoDateTimeConverter() | |
{ | |
DateTimeFormat = "dd.MM.yyyy" | |
}); | |
config.Formatters.Remove(config.Formatters.JsonFormatter); | |
config.Formatters.Add(new JsonNetFormatter(settings)); |
WebApiConfig.cs
For asp.net core web api Startup.cs
?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where can i put this code? A class? Controller?