PC Review


Reply
Thread Tools Rate Thread

DateTime, Web service, Sql server

 
 
Iwan Petrow
Guest
Posts: n/a
 
      21st Sep 2005
Hi,
I have Win application -> Web service -> Sql Server. The user input
date and time in format dd/MM/yy hh:mm. I convert it to datetime and
send it to a web service which save it to the db. But the datetime is
changed according the timezone of the server and the client machine (I
think).

What can I do that the date to stay the same (I want to send datetime
type and I don't want to change windows setting of the server and the
client machine)?

Thanks.

 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      21st Sep 2005
Iwan,

Why do you not sent Zulu/GMT/UTC (three words for the same) to your
webservice

http://msdn.microsoft.com/library/de...ltimetopic.asp

http://msdn.microsoft.com/library/de...tcnowtopic.asp

I hope this helps,

Cor


 
Reply With Quote
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      21st Sep 2005
Iwan,

Which layer is it being translated in? Is the proxy translating it when
it is sent to the web server? Or is the SQL Server translating it?

Either way, before you send it, you might want to convert it to GMT, by
making a call to the ToUniversalTime method on the datetime before you send
it to the web service.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Iwan Petrow" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> I have Win application -> Web service -> Sql Server. The user input
> date and time in format dd/MM/yy hh:mm. I convert it to datetime and
> send it to a web service which save it to the db. But the datetime is
> changed according the timezone of the server and the client machine (I
> think).
>
> What can I do that the date to stay the same (I want to send datetime
> type and I don't want to change windows setting of the server and the
> client machine)?
>
> Thanks.
>



 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      21st Sep 2005
Hi,

That's weird, I have never hear of that, how the client or the web service
knows that the opposite is in a different timezone?

I would bet you have another problem somewhere else.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"Iwan Petrow" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> I have Win application -> Web service -> Sql Server. The user input
> date and time in format dd/MM/yy hh:mm. I convert it to datetime and
> send it to a web service which save it to the db. But the datetime is
> changed according the timezone of the server and the client machine (I
> think).
>
> What can I do that the date to stay the same (I want to send datetime
> type and I don't want to change windows setting of the server and the
> client machine)?
>
> Thanks.
>



 
Reply With Quote
 
Iwan Petrow
Guest
Posts: n/a
 
      26th Sep 2005
Hi,

When I set time zone of the serever machine +2 and timezone of the
client machine +1 (windows os settings) I have this problem. When they
are equal (+2) there is no ptroblem.

 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      26th Sep 2005
> That's weird, I have never hear of that, how the client or the web service
> knows that the opposite is in a different timezone?


> I would bet you have another problem somewhere else.


I've seen this problem with Java webservices talking to .NET ones - the
..NET SOAP deserializer does some time zone alterations under the hood
so that even if you send a UTC date/time from Java, you end up with a
local date/time in .NET. It's all very annoying. I gather it's fixed to
some extent in .NET 2.0, but the problem basically stems from the
DateTime type not having any timezone information.

Jon

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Millisecond values missing when inserting datetime into datetime column of sql Server Manikandan Microsoft C# .NET 4 18th Jul 2007 08:59 PM
How can I save a DateTime from my C# program into a SQL Server (datetime) database column. Steve Kershaw Microsoft ASP .NET 5 29th Aug 2006 03:10 AM
Datetime, SQL Server, Web App, Web Service Iwan Petrow Microsoft C# .NET 3 28th Apr 2005 01:37 PM
DateTime formatting, Web App, Web Service, SQL Server Iwan Petrow Microsoft C# .NET 2 27th Apr 2005 03:32 PM
Inserting C# datetime milliseconds into sql Server DateTime tk042383 Microsoft ADO .NET 2 4th May 2004 04:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:58 AM.