I would like my REST service to return a DateTime as:
- 01-dec-2009 for Accept-Language: en-US
- 01-dez-2009 for Accept-Language: pt-BR
Thanks!
André Carlucci
I would like my REST service to return a DateTime as:
Thanks!
André Carlucci
I would argue that "serialization" means "converting something to text format for interchange/storage" and not to present to a human reader.
By this definition, it must be language independent, and follow the XML serialization convention, or ISO 8601, or a CultureInfo::InvariantCulture. See also http://www.mihai-nita.net/article.php?artID=20051025a
If we don't call it "serialization" then
How are you serializing those DateTimes?
It looks to me like they've been converted to strings, in which case you should be able to inspect the Request.UserLanguages property and inject the appropriate CultureInfo into an ordinary string.Format() call.
The standard XML serializer uses a culture-agnostic format explained here:
The dateTime is specified in the following form "YYYY-MM-DDThh:mm:ss" where:
Note that these should be in UTC.