I\'ve got a WebAPI action that looks like so:
[Route(\"api/values/{id}\")]
public async Task Delete(string id, DateTimeOffset date
The current accepted answer throws away the time zone information, which in some cases is important. The following maintains the time zone and doesn't lose any precision. It also keeps your code succinct when building a query string.
public static string UrlEncode(this DateTimeOffset dateTimeOffset)
{
return HttpUtility.UrlEncode(dateTimeOffset.ToString("o"));
}