Re: DateTime WebService Discrepancy.
From: fhunter (anonymous_at_discussions.microsoft.com)
Date: 03/31/04
- Next message: Ronald: "Re: RFID Testing"
- Previous message: fhunter: "Re: DateTime WebService Discrepancy."
- In reply to: Justin Marshall: "Re: DateTime WebService Discrepancy."
- Next in thread: Alex Feinman [MVP]: "Re: DateTime WebService Discrepancy."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 30 Mar 2004 16:26:11 -0800
Thanks Justine,
You are correct this is probably exactly what's happening. I will send a string (but I hate doing this as I do not like working with strings). I wonder if there is a way to turn the timezone convertion off. As I am passing a UTC value and do not need the convertion.
Also I was concerned about the descrepancy regarding the way it works using Internet Explorer as opposed to calling the Service thru Compact .Net.
----- Justin Marshall wrote: -----
Hi fhunter,
Not sure if this has anything to do with your problem by I had similarly
strange results when the time zone on the handheld and the machine hosting
the webservice was different.
When the datetime is sent by the webservice, it includes the time zone
offset (in hours) of the machine hosting the webservice (in my case +10 for
Australia).
I had left the handheld in its default timezone (US I think) and it seemed
that the handheld took into account the difference in time zone when
returning the date time.
If this is your problem, you could return the date time as a string and
convert it back to a date time at the handheld. This will avoid this
problem.
HTH,
Justin.
"fhunter" <anonymous@discussions.microsoft.com> wrote in message
news:CC7666CC-298A-4243-B0BF-C49A2FE5DEFC@microsoft.com...
> Bill,
>> Thank you for your reply.
> I did what you asked me to and the answers I got where off by 1 hour.
> First MessageBox showed 3/29/2004 5:52:58 PM
> Second MessageBox showed 3/29/2004 6:52:58 PM
> (Note 1 hour is exactly the difference between computer time zones)
> I think the Compact .net code is converting the DateTime before sending it
with out my knowledge? Strange!
>> Second note, this only happends with the Compact .Net client not if I
using explorer to test the same WebService !
> In that case it works fine.
>> Yes, I realize this is a silly use of a WebService, but this is not the
service I am interested in, the actual service does a lot more than just
return the stupid date. I was just making a simple example to proof that I
am not going entirely crazy. :)
> Ofcourse I had not even though of just passing a string as a parameter
instead of a DateTime object, I prefer not to work with strings, but there
is certainly nothing wrong with that. Thank you I had not even through about
doing it that way.
>>>>>> ----- William Ryan eMVP wrote: -----
>> Hi fhunter:
>> Since your web service isn't doing anything at all other than making
a
> string representation, I doubt it's the problem. If you put a break
point
> right before the call to GetDateTime or add a MessageBox, is it
correct to
> say that the time being passed in is correct?
>> ie
> MessageBox.Show(syncDate.ToString()); //Will show 3/29/2004 5:52:58
PM
> string test = mServ.GetDateTime( syncDate );
> MessageBox.Show(test); //Will Show 3/29/2004 6:52:58 PM
>> If the datetime sent is the first value, the return value will be one
hour
> later? If so, then why not just use string test =
syncDate.ToString(); //
> ..ToShortDateString(), ToShortTimeString() etc
> I can't tell if you verified the input b/c of the 'supposedly' but if
the
> time you are sending as a parameter is correct, i'd just use
ToString()
> locally and cut out the call to the web service. This will be easier
to
> code, more straightforward, more efficient and won't be dependent on
the web
> service working. If you haven't verified the parameter you are
passing
> verify it first with the messagebox but use MessageBox.Show( test,
> syncDate.ToString()); and see what the results are. I've copied the
web
> method and fired it from a CF app I just whipped up and it's working
fine so
> the most likely culprit is that the parameter you are passing isn't
what you
> expect. From this code, they should be the same.
>> Anyway, add the lines of code I mentioned and post the results if
you
> would. That will help confirm what the input and output are.
However, I
> don't think you need to web service at all and it's a lot easier to
just do
> without it.
>> Let me know...
>> Bill
>>> "fhunter" <anonymous@discussions.microsoft.com> wrote in message
> news:B70DC4F3-CE29-41B6-A661-79B7F1373C8B@microsoft.com...
>> Can someone shed some light on this one.
>> I have a WebService that takes a DateTime object as a parameter and
return
> it as a string.
>> The reason I am doing this is because when sending the request thru
my
> compact .net app I get a time that is off by 1 hour. I am not doing
> anythign at all with the DateTime at eaither end.
>>> Here is the code on the client:
>> string test = mServ.GetDateTime( syncDate );
>>> Here is the Server code:
>> [WebMethod]
>> public string GetDateTime( DateTime aDateTime )
>> {
>> return( aDateTime.ToString() );
>> }
>>> The result I get is:
>> syncDate.ToString() "3/29/2004 5:52:58 PM" (This is what I am
sending,
> supposedly )
>> test "3/29/2004 6:52:58 PM" (This is what I get
back )
>>> In addition, if I try my WebService from explorer sending
"3/29/2004
> 5:52:58 PM" the result comes back as expected:
>> "3/29/2004 5:52:58 PM"
>>> Is this a bug, or am I missing something?
>>
- Next message: Ronald: "Re: RFID Testing"
- Previous message: fhunter: "Re: DateTime WebService Discrepancy."
- In reply to: Justin Marshall: "Re: DateTime WebService Discrepancy."
- Next in thread: Alex Feinman [MVP]: "Re: DateTime WebService Discrepancy."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|