SQL Server Performance

Converting a datetime to another locale

Discussion in 'General Developer Questions' started by nilayinc, Jul 31, 2003.

  1. nilayinc New Member

    I need to compare 2 different dates belonging to different time zones. For that, I would need to convert both of them to a common timezone (locale) or GMT.
    Which is the function in SQL server that can help me do that ?
  2. bambola New Member

    There is a function GETUTCDATE() that returns the UTC time. It is obvsiouly based on the settings of the SQL machine. I think you should bring dates to the same timezone than compare them like you do with dates in general (DATEDIFF).

    Bambola.
  3. Twan New Member

    There is no automatic way (that I know of) of changing a date's timezone from one zone to another. You could use dateadd to add or subtract the right number of hours from one of the dates to put it in the same timezone as the other... (can get tricky with daylight saving, if you have lots of historic information...)

Share This Page