繁体   English   中英

SQL Server 2019 on Linux 时区问题

[英]SQL Server 2019 on Linux Time Zone Problem

为什么会有不同的结果(偏移量应该是 +03:00):

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

结果是:

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

linux时间为:

       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

我意识到 SQL 服务器不在乎土耳其采用+03:00,不使用夏令时并得到了临时解决方案。 SQL 服务器在欧洲/伊斯坦布尔无法正常工作,因此我将欧洲/莫斯科与它设置为同一时区。

1- timedatectl set-timezone Europe/Moscow 2- systemctl restart mssql-server

问题解决了。

CURRENT_TIMEZONE() SYSDATETIMEOFFSET() (UTC+03:00) 莫斯科,圣彼得堡 2022-02-02 17:39:04.6127420 +03:00

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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