Local Time Issue

  • Good evening,

    I have a store procedure that returns result to users around the places such as China, England, US and etc....  These users access our sqlserver through terminal server.  When they execute the procedure, they all see the same result because the time is our sqlserver's time.  My task is to return the correct result set based on the users' local time.  How can I achive it.  Thanks a lot for your help.

    Minh Vu

  • IF they access your system via Terminal Services..

    Unfortunately, because they are using Terminal Services it is as if they are sitting at the server...

    Only way I could think of is to build a user table add all of your users into it and have a column in it of DATEDIFF in hours +-(n)

    This way you would reference the following:

    SELECT DATEADD(HOURS, GETDATE(), TimeDiff) FROM tblEmployee WHERE UserID = @UserLoggedIn (I know there is a function built in to get the current user Im too tired to find it)

    This would always give "local" time in a way....

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • I see.  Thanks a lot.

    How's about GETUTCDATE()? Can I used this function instead? Actually, I'm not sure how this function will work.

    Minh Vu

     

  • Unfortunately, that wouldn't work.  Regardless of where the user really is in the world the SQL SERVER thinks that they are physically sitting in front of it touching it's physical keyboard

    hope this helped....



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

Viewing 4 posts - 1 through 3 (of 3 total)

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