How can I control DateTime
output format when content is requested as application/xml
? The following works for JSON:
JsonMediaTypeFormatter jsonFormatter = config.Formatters.JsonFormatter;
jsonFormatter.SerializerSettings = new JsonSerializerSettings {
DateFormatString = "yyyy-MM-dd" };
What's the equivalent for XmlMediaTypeFormatter
?
Update: Semantically, my data have no time information. Technically, I want to a) minimize payload b) simplify consumption (no need to process/format on client side) c) consistent responses regardless of format asked.