local time and UTC time for SQL Server

Source: Internet
Author: User
Tags getdate time zones local time

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.