473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

strange date behavior

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>JENNA</GivenName><FamilyName>BOWER</FamilyName><BirthDate>1997-03-02T16:00:00.0000000-08:00</BirthDate><Gender>F</Gender></MatchValues></CheckMatch></soap:Body></soap:Envelope>
Sep 27 '06 #1
3 1467
"Jeremy Chapman" <please@Idontlikespamwrote in message
news:eC**************@TK2MSFTNGP02.phx.gbl...
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?
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
Sep 28 '06 #2

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.

--
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.
"John Saunders" wrote:
"Jeremy Chapman" <please@Idontlikespamwrote in message
news:eC**************@TK2MSFTNGP02.phx.gbl...
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?

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
Sep 29 '06 #3
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();
}
}

}

"Franklin M. Gauer III" <Fr***************@discussions.microsoft.comwrot e
in message news:2B**********************************@microsof t.com...
>
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.

--
Franklin M. Gauer III
Applications Development Manager
Integrated Companies, Inc.
"John Saunders" wrote:
>"Jeremy Chapman" <please@Idontlikespamwrote in message
news:eC**************@TK2MSFTNGP02.phx.gbl...
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?

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

Oct 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kyle James Matthews | last post by:
I am working with the following script for a weblog that manipulates any combination of two variables: $postauthor and $archive. if (isset($HTTP_GET_VARS)) { $archive = $HTTP_GET_VARS; if...
5
by: AHN | last post by:
Please tell me somebody what causes the cookie set with <% Response.Cookies("blah") = "Blah blah" Response.Cookies("blah").Expires = DateAdd( "h", 1, Now() ) %> work as supposed on my local...
1
by: Luigi | last post by:
I noted a particular behavior shown by IE. Look at the simple page attached at the bottom of the post. In it, there is a box floated with the float property and another box that jumps it with the...
18
by: genc ymeri | last post by:
Hi, I just noticed that while trying to run this code : MessageBox.Show("Hello"); the message box pops up but shows no string/message in it. (expecting the "Hello" string). Even the "OK"...
1
by: Justice Gray | last post by:
I have the following code encapsulated in an ascx page (user control): namespace MyCompany.Web.UserControls { string webform_namespace = this.GetType().Namespace.ToString(); } Now, when I...
1
by: Maileen | last post by:
Hi, I finished my application butonce again i have some strange behavior with XML/text functions... for example, here below is a function which worked perfectly till now and now generate an...
3
by: Bill | last post by:
I'm using the POST method to submit a simple form html page with yes/no and checkbox fields to an asp response page which stores the values in a new dim string, then uses it to build a new table...
6
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to...
8
by: FBM | last post by:
Hi there, I am puzzled with the behavior of my code.. I am working on a networking stuff, and debugging with eclipse (GNU gdb 6.6-debian).. The problem I am experiencing is the following: ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.