One, local time and UTC time
local time
Each region of the world has its own local time, the entire earth is divided into 24 time zones, each time zone has its own local time.
UTC time
In international radio communications, a standard time is commonly used for unification, known as universal Coordination (UTC, Universal times coordinated). UTC time is the same as the local time in London, UK.
UTC time is the same in all parts of the world, but in different time zones, local time varies. The local time can be calculated based on UTC time and the time zone in which it is located.
Two, get local time and UTC time
In SQL Sever, GetDate () returns the local time, getUTCDate () returns the UTC time, the data type returned is Datetime;sysdatetime () returns the local time, Sysutcdatetime () Returns the UTC time, the data type returned is DateTime2 (7).
UTC time is the same in different time zones, but local time is different. Local time is the system time displayed on the server, changing the time zone in the OS and the ability to modify the return value of local time and getdate (). local time is derived based on UTC time and the time zone set by the OS.
Conclusion: GetDate () and Sysdatetime () return the date and time of the local server, which is related to the OS of the PC on which the instance of SQL Server is located, and is the same as the OS display.
Third, the time that the SQL Agent executes the job
The time that is used in the SQL Server agent is local time, and the job execution time is local time.
local time and UTC time for SQL Server