I was wondering for best practices here and couldn't find a suitable answer..
What do you thing about passing datetime (or timespan) as a parameter to a web method? Pros and cons and what to use if not datetime (string?? what format??) ?
I have recently written a web service, the web method had a datetime parameter and I hadseveral issues with that:
1.Time difference issues
I think that in my case it wasbetter to send delta time (timespan), by doing so, differences in time between the client and the server (if the time is taken from the local machine) can be avoided (the machines clock not syncronized).
2.Platform compatibility
I had to write an unmanaged client, I didn't know how date time was parsed and serialized, my client proxy obviously didn't know date time object and passed a string (the proxy was created using sproxy.exe). So using a sniffer I saw time looked like: "2008-06-23T13:14:28.4832978+01:00" when passes from a managed client passing datetime, so I formatted my time on the unmanaged client to this format.
However this seems like a to fur fetched solution and was wondering what do you think? What's the best way to pass date and time in web services? should it be local (since I think passing dateTime already handles time zones) or UTC\GMT? what format?