Re: DateTime WebService Discrepancy.
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 03/29/04
- Next message: Flynn Arrowstarr: "Re: Windows mobile second edition?"
- Previous message: Madtown_Mike: "Smart Device Application Error"
- In reply to: fhunter: "DateTime WebService Discrepancy."
- Next in thread: fhunter: "Re: DateTime WebService Discrepancy."
- Reply: fhunter: "Re: DateTime WebService Discrepancy."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 29 Mar 2004 13:59:05 -0500
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: Flynn Arrowstarr: "Re: Windows mobile second edition?"
- Previous message: Madtown_Mike: "Smart Device Application Error"
- In reply to: fhunter: "DateTime WebService Discrepancy."
- Next in thread: fhunter: "Re: DateTime WebService Discrepancy."
- Reply: fhunter: "Re: DateTime WebService Discrepancy."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|