Maybe I wasn't clear. When you pass a DateTime in a C# web service the
databinding layer always assumes that you've given it UTC time since
DateTime doesn't actually store the timezone. When you do
DateTime.Parse("01/05/2007
01:00:00"); it creates a DateTime with the timezone UTC+0 from the point of
view of C#'s web service layer. When you call dateTime.ToUniversalTime() the
call basically says "guess it wasn't UTC afterall, I'll assume the DateTime
was local now and create a UTC time from that". So it makes sence that
dateTime.ToUniversalTime() would in fact solve your problem.
- Dan
On 1/9/07, Alexander Anguiano <[EMAIL PROTECTED]> wrote:
hmmm...
I'm in central standard time.
I have the client and the server on the same computer. I expect the
DateTime to translate properly to a java.sql.Timestamp
From Csharp i do this
DateTime t = DateTime.Parse("01/05/2007 01:00:00");
and i expect that to be the same java.sql.Timestamp in the xfire web
services.
I noticed if i do this
DateTime
t = DateTime.Parse("01/09/2007 10:12:00 AM").ToUniversalTime();
It will work correctly.
Perhaps it something in my enviroment that is causing this not to work
with out the ToUniversalTime()
Is there something that i'm doing wrong?
Is anyone Sending DateTime object from csharp to a x-fire service?
Thanks :-)
------------------------------
*From:* Dan Diephouse [mailto:[EMAIL PROTECTED]
*Sent:* Tuesday, January 09, 2007 10:35 AM
*To:* [email protected]
*Subject:* Re: [xfire-user] Csharp DateTime serialization format is wrong?
The .NET DateTime documentation says [1]:
"Descriptions of time values in this type are often expressed using the
coordinated universal time (UTC) standard, which was previously known as
Greenwich mean time (GMT)."
Not including a timezone in the XML means that its in UMT+0. So I'm
guessing that you're in the UTC-5 timezone (aka EST) by the looks of it. If
so - all the conversions are correct as 2007-01-08 19:00:00 in UTC-5 is
the same thing as 01/09/2007 01:00:00 UTC+0.
- Dan
1.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimeclasstopic.asp
On 1/9/07, Alexander Anguiano <[EMAIL PROTECTED]> wrote:
>
> I don't get an error. My time is off by 5 hours. I have a scheduler
> and i'm scheduling a task to run at 01/09/2007 01:00:00. In my csharp
> client i print the time and its correct. On my xfire web services I print
> the time I receive from the csharp client and it is 2007-01-08 19:00:
> 00.0.
>
> When i run the tcpmonitor I see that the csharp client has not added the
> offset.
>
> <onDate>2007-01-09T01:00:00</onDate>
>
> if the offset was in the xml then the time would be correct in my xfire
> web service
>
>
> ------------------------------
> *From:* Dan Diephouse [mailto:[EMAIL PROTECTED]
> *Sent:* Tuesday, January 09, 2007 9:07 AM
> *To:* [email protected]
> *Subject:* Re: [xfire-user] Csharp DateTime serialization format is
> wrong?
>
> What error does XFire give you?
> Regards
> Dan
>
> On 1/8/07, Alexander Anguiano <[EMAIL PROTECTED] > wrote:
> >
> > I thought the web standard include the offset. My problem is
> >
> > The Csharp client generates this
> > <onDate>2007-01-05T01:00:00</onDate>
> >
> > I believe Xfire is expecting the offset so when it deserialized my
> > time
> > it is translated to this
> >
> > 2007-01-04 19:00:00.0
> >
> > 5 hours off
> >
> > The funny thing is that it used to work. I'm not sure what changed in
> >
> > my enviroment to make it stop working.
> >
> > -----Original Message-----
> > From: Karl Palsson [mailto:[EMAIL PROTECTED]
> > Sent: Monday, January 08, 2007 10:27 AM
> > To: [email protected]
> > Subject: RE: [xfire-user] Csharp DateTime serialization format is
> > wrong?
> >
> >
> > Well, they're both perfectly valid and correct xsd:Datetimes. What
> > "web
> > standard" are you referring to?
> >
> > http://www.w3.org/TR/xmlschema-2/#dateTime
> >
> > As far as including/excluding the timezone goes, I can't really help
> > you.
> >
> >
> > > -----Original Message-----
> > > From: Alexander Anguiano [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, January 08, 2007 3:46 PM
> > > To: [email protected]
> > > Subject: [xfire-user] Csharp DateTime serialization format is wrong?
> > >
> > >
> > >
> > > (I used tcpmonitor to get the soap message fragment)
> > >
> > >
> > > DateTime t = DateTime.Parse("01/05/2007 01:00:00");
> > >
> > > serialized to this.
> > >
> > > <onDate>2007-01-05T01:00:00</onDate>
> > >
> > > It used to serialize as this
> > >
> > > <onDate>>2007-01-05T01:00:00.0000000-05:00</onDate>>
> > >
> > >
> > > Does anyone know why this happens and if there is a setting that i
> > > have to set in VS to make it serialize to the web standard?
> > >
> > > I use java 1.5.9, xfire 1.2, Visual C# 2005 Express Edition
> > >
> > > The wsdl generated this for the field
> > >
> > > <xsd:element maxOccurs="1" minOccurs="1" name="onDate"
> > > nillable="true" type="xsd:dateTime" />
> > >
> > > Thanks
> > > Alexander
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> > http://xircles.codehaus.org/manage_email
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> > http://xircles.codehaus.org/manage_email
> >
> >
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog