SQL Server Location Time and Data Time

  • Our SQL Server is located in PST and we are in EST....

    The users are setting up data using and thinging the app will work based on their time zone i.e. EST and our server is hosted in PST. So, when we execute the SPs based on GETDATE(), they are pulling the data based on PST.

    How to solve this?

    Thanks a lot in advance.

  • Not knowling exactly how your T-SQL statement are composed you might think of creating a function based on either East Coast time minus some hours or Greenwhich mean time minus some hours. The examples below are illustrative only to get you thinking.

    DECLARE @Diff AS INT

    SET @Diff = 3

    SELECT GETDATE() AS 'East Coast time',DATEADD(hh,-@Diff,GETDATE()) AS 'Calulated Pacific Coast time',

    GETUTCDATE() AS 'Coordinated Universal Time or Greenwich Mean Time

    '

    Which gives:

    East Coast time Calulated Pacific Coast timeCoordinated Universal Time or Greenwich Mean Time

    2009-10-14 18:24:34.5602009-10-14 15:24:34.5602009-10-14 22:24:34.560

    A problem will exist on the annual changes from standard time to day light savings time/ and back and that might be included in your function based on the date/time of changing of the clocks.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply