I've created a web service method which looks like
public MatchResult CheckMatch(MatchData MatchValues)
MatchData is a class defined as:
public class MatchData
{
public string GivenName;
public string FamilyName;
public DateTime BirthDate;
public string Gender;
}
When I call the web service, I set the BirthDate property to March 3, 1997,
and when I trace the soap call I see that the date is
"1997-03-02T16:00:00.0000000-08:00"
In my web service, I debug it and when I inspect the MatchData instance, I
see that the BirthDate property contains 1997-03-02 as the date and 16:00 as
the time. Now, the date is 1 day off. Anyone know what causes this and how
to fix it?
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CheckMatch
xmlns="http://mycompany.ca/WebServices"><MatchValues><PHN>9873835731</PHN><GivenName>JE
NNA</GivenName><FamilyName>BOWER</FamilyName><BirthDate>1997-03-02T16:00:00.0000
000-08:00</BirthDate><Gender>F</Gender></MatchValues></CheckMatch></soap:Body></
soap:Envelope>
John Saunders - 28 Sep 2006 12:19 GMT
> I've created a web service method which looks like
> public MatchResult CheckMatch(MatchData MatchValues)
[quoted text clipped - 14 lines]
> as the time. Now, the date is 1 day off. Anyone know what causes this
> and how to fix it?
This looks like a time zone problem. "March 3, 1997" in which timezone?
Pacific (-8)?
What's the offset from where you are to GMT? 13? So, maybe 1997-03-02T16:00
+ 13 = 1997-03-03T05:00?
I'm not completely sure, but this does seem like a timezone issue.
John
Franklin M. Gauer III - 29 Sep 2006 21:35 GMT
Yes - depending on where your webserver is and where your client is - a
timezone conversion will be done. If the webserver is set to a different
timezone than your client - this will occur.
I'm not aware of a system setting that will prevent this from happening (if
you don't want it to happen - maybe someone else on the forums knows). We've
taken care of this in the past by writing functions that 'take away' this
effect when we pass dates up to our webservices.

Signature
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.
> > I've created a web service method which looks like
> > public MatchResult CheckMatch(MatchData MatchValues)
[quoted text clipped - 24 lines]
>
> John
Jeremy Chapman - 06 Oct 2006 00:35 GMT
Yes, it is a time zone issue, even though both machines are in the same time
zone and have the same system date.
I solved it in my class by converting it to universal time before storing
it.
public class MatchData
{
private DateTime dtBirthDate_m;
public string PHN;
public string GivenName;
public string FamilyName;
public string Gender;
public DateTime BirthDate
{
set
{
dtBirthDate_m = value.ToUniversalTime();
}
get
{
return dtBirthDate_m.ToLocalTime();
}
}
[System.Xml.Serialization.XmlIgnore]
public DateTime BirthDateUTC
{
set
{
dtBirthDate_m = value;
}
get
{
return dtBirthDate_m.ToUniversalTime();
}
}
}
> Yes - depending on where your webserver is and where your client is - a
> timezone conversion will be done. If the webserver is set to a different
[quoted text clipped - 38 lines]
>>
>> John