Webservice converts Datetime from one timezone to the other

S

sameer

Environment : framework 1.1, winforms, webservices, sql server 2000

Architecture of the application : database is hosted behind the webserver.
Client winforms application is installed on the client machine and webservice
are used to transfer the data from the client exe to the database over the
internet. Database\ webserver server is running on GMT time where as the
client machines can be running on any time zone. Ado.Net Datasets are used to
transfer the data between the client machine to the database over the
webservice.

Here is my problem :
Lets say client EXE is running on a machine that has Eastern time zone, user
modifies a date which is now '6/23/2007 4:20:30', this modifications along
with the others mdifications user has done are put in a dataset and send
across the webservice to the database( where the timezone is different and is
GMT), so here is the problem, seems when the webservice gets this dataset it
automatically converts the datetime from Easter to GMT and saves it to the db
i.e the new datatime is '6/22/2007 11:20:30' ( 5 hrs behind of the easter). I
want the same date that the user selects to be saved in the database without
any conversions. Any suggestions on how i can do this? the client exes can be
running on all different timezone worldwide

Please suggest.

thanks
 
M

Manish Bafna

Hi,
Timezone aware Datetime Datatype are not supported in SQL Server
2000/2005.This feature is proposed to be included in sql server 2008.Till
then you will need to manage it on front end.That is in .net winforms.Right
now there is nothing you can do at sql server level.Search for "globalization
cultureinfo c#" in google and you will tutorials as how to implement in .net
winforms.
 
S

sameer

thanks for your answer Manish, I know there is nothing in sqlserver that can
do that, i was looking for more specific info about stopping the dataset
object from auto-converting it from one timezone to the other, ones again as
easy as this ... even if the dataset is being converted from Easter time zone
to GMT time zone, i want the datetime '6/23/2007 4:20:30' to be this and not
be converted over to GMT datetime.
Let me know if you have any specific info on this.

thanks
 
D

Doug

Sameer,

I am having the exact same problem. I will respond back when I find a
solution to it!

Thanks,

Doug
 
C

chetan

i have the same problem but it can be solved if u change ur database datatype as datetime to string.............i hope it can be solved
 
C

chetan

i have the same problem but it can be solved if u change ur database datatype as datetime to string.............i hope it can be solved
 
S

sameer

ya , ithink that is a good idea but that woudl require me to do a log of code
changes.
any other ideas using which i can just still the webservice not to do any
datetme conversions?
 
S

sameer

thanks for the link Andrew ,

your answer does definetly help and that is how i am going to handle this
issue with the datetime conversion. so basically the idea is to have client
side code which add an extended property to the dataset in which it stores
the information that is then used to calcualte the client side datetime on
the server.

To minimize the client side coding to add this extended property to the
dataset before it is being send across the webservice( i am having 100s of
calls to webservice all over the application and adding this code to each
call might take a long time) i am thinking if it is possible to write this
code at a central place where it can be read by all datasets gong out of the
webservice.

Below are the details :

overwrite the client side webservice;s proxy's GetWebRequest method which
would give me access to the request object and then somehow check to see if
it has a dataset object within it and if it does then add this extended
property to it and then send it out. And a similiar thing on the client side
for incomming datasets in which case i woudl want to overwrite the
webservice;s proxy's GetWebResponse method and convert the datetime using the
dataset;s extended property which was added to it by the server side code.

As far as code for the server side, i think i can easily write it for all
the methods so no concern over there.

Any body any clue on this one, please suggest!

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top