Search code examples
sql-serverazure-sql-databasessms

SQL Server is 2 hours delayed than my current time


This is a SQL database on Azure:

Time in SQL Server vs my time

I'm trying to execute SELECT GETDATE() and it shows the date 2 hours later than my current time.

I tried to check the time zone in SQL Server and it shows '(UTC) Coordinated Universal Time'. Is there any solution for SQL Server to show the right time when I know the zone that I'm in?


Solution

  • The proper solution is not to change the Database time zone,

    instead, you should just convert any time to your local time, like this:

    SELECT  SYSDATETIMEOFFSET() AT TIME ZONE 'E. Europe Standard Time'