简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM