Problem:
Given my Asp.NET Web API is set up as follows
Platform: ASP.NET 4.5, Owin, C#,
Globalisation Culture: en-GB
When I create a Url link using UrlHelper in the ApiController with date from set to Today, 2nd Sept 2016:
var someObject = new SomeObject{ ..., DateFrom = DateTime.Today, ... };
base.Url.Link("whatever", someObject );
Then I get a result where the date is encoded to en-US (09/02/2016 00:00:00)
http://localhost:52321/...DateFrom=09%2F02%2F2016%2000%3A00%3A00
Questions
How do override the process so that the output is more "friendlier", thus
http://localhost:52321/...DateFrom=2016-09-02
How to I achieve this without converting to an anonymous object with a string date, thus
var someObject = new SomeObject{ ..., DateFrom = DateTime.Today, ... };
var anon = new { ..., DateFrom = someObject.DateFrom.ToString("yyyy-MM-dd"), ...}
base.Url.Link("whatever", anon ); // no thanks
Update
At the very least, I want the encoding to be en-GB (02/09/2016 00:00:00). Because I find the behaviour very odd since my current culture is en-GB and not en-US. Thus...
http://localhost:52321/...DateFrom=02%2F09%2F2016%2000%3A00%3A00