I\'m trying to send a DateTime
as a parameter to a method exposed over a WCF RESTful service with JSON encoding. The request looks like this:
POST h
Just in case this helps somebody:
According to Microsoft, WCF uses a QueryStringConverter to do the url parsing. Thus, using this code (slight modification of the msdn example):
QueryStringConverter converter = new QueryStringConverter();
if (converter.CanConvert(typeof(DateTime)))
{
string strValue = converter.ConvertValueToString(DateTime.UtcNow, typeof(DateTime));
Console.WriteLine("the value = {0}", strValue);
}
we get the proper format for DateTime REST parameters: 2010-01-01T01:01:01Z
I did read that you tried this format, but just wanted to confirm that this is indeed the way it's supposed to work. I thought of answering since this question came up first when I searched for this.
This worked for me using .NET 4.0