Hi,
Please bear with me on this problem, first I'll give you some background:
I have an object that contains a DateTime field which i pass to a webservice
public class Foo {
public DateTime RequestDate;
}
public class FooWebService : System.Web.Services.WebService {
[WebMethod]
public void FooWebMethod(Foo value) {
// Do something
}
}
On a client app i can then consume this webserivce like this:
localhost.Foo f = new localhost.Foo();
f.RequestDate = DateTime.Parse("27/5/2003");
localhost.FooWebService service = new localhost.FooWebService();
service.FooWebMethod(f);
Now the .Net framework handles the serialization of the Foo object into xml
and then passes it to the webservice, the object is the rehydrated by the
framework. I can see xml element for the RequestDate field has a value
(namespace uri omitted)
<Foo>
<RequestDate>2003-05-27T00:00:00.0000000+10:00</RequestDate>
</Foo>
The problem occurs when the client and the webservice reside in different
timezones. My client is in Sydney (GMT+10) whereas the webservice is in
Adelaide (GMT+9:30). When the Foo object is rehydrated by the framework it
converts the serialized xml date string into the DateTime value '26/5/2003'
rather than '27/5/2003', I assume because its adjusting for the half hour
time difference. Is there anyway to stop this behaviour ?
tia
andrew