Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Link creation with dates

$
0
0

Within a Json response I am returning a link to a URL using UrlHelper as follows:

Url.Link("DefaultApi", new { controller = "MyController", time = model.Time } )

This is creating a query string parameter for "time" in the URL, as I was expecting, but it is formatted as (what I would call) a U.S. date (month, day, year, hour, minute, second). I think this is due to the conversion of a DateTime in the invariant culture producing a U.S. formatted date (which is odd in itself), but I would much prefer if the date were formatted according to ISO 8601.

I can do this conversion manually, in each controller, but I am looking for an extension point that will do this for all query string parameters of type DateTime. Searching around I can't see that any of the many Web API extension points allow control over the formatting of query string parameters.

Is there a way to do this?

Thanks.


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>