Webservice converts Datetime from one timezone to the other

Discussion in 'ASP .Net Web Services' started by sameer, Jun 13, 2007.

  1. sameer

    sameer Guest

    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
     
    sameer, Jun 13, 2007
    #1
    1. Advertising

  2. sameer

    Manish Bafna Guest

    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.
    --
    Hope this helps.
    Thanks and Regards.
    Manish Bafna.
    MCP and MCTS.



    "sameer" wrote:

    > 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
     
    Manish Bafna, Jun 14, 2007
    #2
    1. Advertising

  3. sameer

    sameer Guest

    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

    "Manish Bafna" wrote:

    > 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.
    > --
    > Hope this helps.
    > Thanks and Regards.
    > Manish Bafna.
    > MCP and MCTS.
    >
    >
    >
    > "sameer" wrote:
    >
    > > 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
     
    sameer, Jun 14, 2007
    #3
  4. sameer

    Doug Guest

    Sameer,

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

    Thanks,

    Doug

    "sameer" wrote:

    > 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
     
    Doug, Jun 18, 2007
    #4
  5. sameer

    sameer Guest

    Doug, thanks shall be waiting.

    "Doug" wrote:

    > Sameer,
    >
    > I am having the exact same problem. I will respond back when I find a
    > solution to it!
    >
    > Thanks,
    >
    > Doug
    >
    > "sameer" wrote:
    >
    > > 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
     
    sameer, Jun 19, 2007
    #5
  6. sameer

    chetan Guest

    Re: Webservice converts Datetime from one timezone to...

    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
     
    chetan, Jul 4, 2007
    #6
  7. sameer

    chetan Guest

    Re: Webservice converts Datetime from one timezone to...

    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
     
    chetan, Jul 4, 2007
    #7
  8. sameer

    sameer Guest

    Re: Webservice converts Datetime from one timezone to ...

    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?


    "chetan" wrote:

    > 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
    >
     
    sameer, Jul 5, 2007
    #8
  9. sameer

    Andrew Guest

    read this article ...see if this help you
    http://support.microsoft.com/kb/842545/en-us

    "sameer" wrote:

    > 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
     
    Andrew, Jul 5, 2007
    #9
  10. sameer

    sameer Guest

    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





    "Andrew" wrote:

    > read this article ...see if this help you
    > http://support.microsoft.com/kb/842545/en-us
    >
    > "sameer" wrote:
    >
    > > 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
     
    sameer, Jul 23, 2007
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    712
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    538
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    393
    John Machin
    Jul 28, 2006
  4. Ami
    Replies:
    5
    Views:
    281
  5. Justin Voelker
    Replies:
    2
    Views:
    267
    Dr J R Stockton
    Dec 2, 2008
Loading...

Share This Page