Hey

Im calling a webservice wich is returning a DataSet. In the DataSet, wich is
generated from a SQL query, there is a date field. This datefield (datetime)
has the value '12-04-2004' (Danish date format, or actually i think it
stores it as italian in the database. Corresponds to DD-MM-YYYY).

If i try to write the returned DataSets values out, in my program from the
returned DataSet it keeps writing '11-04-2004 15:00:00'. What is that?

Anyone who can explain to me what happens?

Ive tried to see wether the value that is written is right, in the xml
document that returns from the web service. The value looks like this:
<dato>2004-04-18T00:00:00.0000000+02:00</dato>

So i presume that the returned value is correct, but it is apparently wrong
in the dataset on the client side, or it is converted to the day before
during writing out the value.

label1.Text = DataSet.Tables[0].Rows[0]["dato"].toString();

label1.Text is now '11-04-2004 15:00:00' even though the value in the
returning xml document says the 12. April 2004

It happens with all of my dates. They are all set to the previous day at
1500 hours

How can i solve my problem?
Anyone knows anything about this?

Please help....

--

Cheers
Jimmy

Re: Returned values from web service is wrong by Christopher

Christopher
Mon Apr 19 13:13:47 CDT 2004

Hi,

The following article gives an overview over DateTime related issues:
http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dndotnet/html/datetimecode.asp

Extract from the article:

"When using the .NET Framework version 1.0 and 1.1, DO NOT send a DateTime
value that represents UCT time thru System.XML.Serialization. This goes for
Date, Time and DateTime values. For Web services and other forms of
serialization to XML involving System.DateTime, always make sure that the
value in the DateTime value represents current machine local time. The
serializer will properly decode an XML Schema-defined DateTime value that is
encoded in GMT (offset value = 0), but it will decode it to the local
machine time viewpoint."


The DateTime is also a struct, not a class, so it might give weird results
depending on how you use it.

Chris


"Jimmy" <pleasereplyingroup@hotmail.com> wrote in message
news:Ovu1kjeJEHA.2660@tk2msftngp13.phx.gbl...
> Hey
>
> Im calling a webservice wich is returning a DataSet. In the DataSet, wich
is
> generated from a SQL query, there is a date field. This datefield
(datetime)
> has the value '12-04-2004' (Danish date format, or actually i think it
> stores it as italian in the database. Corresponds to DD-MM-YYYY).
>
> If i try to write the returned DataSets values out, in my program from the
> returned DataSet it keeps writing '11-04-2004 15:00:00'. What is that?
>
> Anyone who can explain to me what happens?
>
> Ive tried to see wether the value that is written is right, in the xml
> document that returns from the web service. The value looks like this:
> <dato>2004-04-18T00:00:00.0000000+02:00</dato>
>
> So i presume that the returned value is correct, but it is apparently
wrong
> in the dataset on the client side, or it is converted to the day before
> during writing out the value.
>
> label1.Text = DataSet.Tables[0].Rows[0]["dato"].toString();
>
> label1.Text is now '11-04-2004 15:00:00' even though the value in the
> returning xml document says the 12. April 2004
>
> It happens with all of my dates. They are all set to the previous day at
> 1500 hours
>
> How can i solve my problem?
> Anyone knows anything about this?
>
> Please help....
>
> --
>
> Cheers
> Jimmy
>
>



Re: Returned values from web service is wrong by Jimmy

Jimmy
Tue Apr 20 03:25:28 CDT 2004

"Christopher Kimbell" <a@b.c> skrev i en meddelelse
news:40841501@news.broadpark.no...
> Hi,
>
> The following article gives an overview over DateTime related issues:
>
http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dndotnet/html/datetimecode.asp
>
> Extract from the article:
>
> "When using the .NET Framework version 1.0 and 1.1, DO NOT send a DateTime
> value that represents UCT time thru System.XML.Serialization. This goes
for
> Date, Time and DateTime values. For Web services and other forms of
> serialization to XML involving System.DateTime, always make sure that the
> value in the DateTime value represents current machine local time. The
> serializer will properly decode an XML Schema-defined DateTime value that
is
> encoded in GMT (offset value = 0), but it will decode it to the local
> machine time viewpoint."

This is the problem. It gives me the time i select from my database in UTC
time plus or minus my local time (+02:00). At the client side i guess it
just interprets the time and write it out. Therefore the difference in time.
Im a little confused about the actual timespan, but definetely, this is the
problem.

Thanks...