添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

SQL Server GETUTCDATE Function

In SQL Server, the GETUTCDATE() function returns the current system UTC(Coordinated Universal Time) as a datetime. This does not include the time zone offset. This value is derived from the operating system of the computer hosting the SQL Server instance.

Syntax:

GETUTCDATE()
    

Parameters:

None.

Return Value:

Returns the current UTC DateTime value as DateTime type.

In the following example, the GETUTCDATE() function returns the current UTC datetime of the computer running SQL Server instance.

Example: GETUTCDATE()
SELECT GETUTCDATE() AS CurrentUTCDateTime
    

Use the CONVERT() function with GETUTCDATE() to get the current date or time portion.

Example: GETUTCDATE()
SELECT CONVERT(date, GETUTCDATE()) AS CurrentUTCDate,
CONVERT(time, GETUTCDATE()) AS CurrentUTCTime;