Ali Rıza Arslan
Ali Rıza Arslan

Reputation: 9

SQL Server 2019 on Linux Time Zone Problem

Why there are different results (offset should be +03:00):

SELECT
    CURRENT_TIMEZONE() as [CURRENT_TIMEZONE()] , SYSDATETIMEOFFSET() as [SYSDATETIMEOFFSET()];

result is :

CURRENT_TIMEZONE()        SYSDATETIMEOFFSET()
(UTC+03:00) Istanbul      2022-01-20 10:32:03.6897159 +02:00

linux time is :

       Local time: Thu 2022-01-20 11:32:07 +03
  Universal time: Thu 2022-01-20 08:32:07 UTC
        RTC time: Thu 2022-01-20 08:32:07
       Time zone: Europe/Istanbul (+03, +0300)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

Upvotes: 0

Views: 874

Answers (1)

Ali Rıza Arslan
Ali Rıza Arslan

Reputation: 9

I realized SQL Server does not care Turkey adopted +03:00, does not use daylight saving and got a temporary solution. SQL Server does not work properly for Europe/Istanbul so I set Europe/Moscow same time zone with it.

  1. timedatectl set-timezone Europe/Moscow

  2. systemctl restart mssql-server

Problem is solved.

**CURRENT_TIMEZONE() SYSDATETIMEOFFSET()**
(UTC+03:00) Moscow, St. Petersburg 2022-02-02 17:39:04.6127420 +03:00

Upvotes: 0

Related Questions