此问题可能是由于AWS-RDS MSSQL服务器上的系统时钟不正确导致的。为了修复此问题,请执行以下步骤:
SELECT @@TIME_ZONE
如果时区设置正确,该查询应返回“UTC”。
如果上述步骤没有解决问题,请考虑使用以下代码示例:
-- This script sets the timezone to GMT and reboots the server -- You may need to change the timezone value to suit your needs EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE; GO EXEC sp_configure 'timezone offset', 0; GO RECONFIGURE; GO EXEC sp_configure 'show advanced options', 0; GO RECONFIGURE; GO SHUTDOWN WITH NOWAIT; GO
-- Wait for the server to stop -- Start the server again
此代码示例将时区设置为GMT并重新启动服务器。请注意,您需要将时区偏移值更改为适合您的需求。