SQL Server SYSUTCDATETIME() Function
Updated on
SYSUTCDATETIME() returns the current UTC date and time as datetime2(7). The value is UTC, but the data type does not contain a time-zone offset. Its fractional-second precision is 100 nanoseconds; actual clock accuracy depends on the operating system and hardware. See Microsoft’s SYSUTCDATETIME documentation.
Syntax
SYSUTCDATETIME()
Examples
Retrieve the current UTC value:
SELECT SYSUTCDATETIME() AS current_utc_datetime;
Store it in a datetime2 column:
CREATE TABLE dbo.Events (
event_id bigint PRIMARY KEY,
created_at_utc datetime2(7) NOT NULL
);
INSERT INTO dbo.Events (event_id, created_at_utc)
VALUES (1, SYSUTCDATETIME());
For a lower-precision datetime result, see GETUTCDATE(). To return a value that also contains the system’s current offset, use SYSDATETIMEOFFSET(). For a named time zone, see AT TIME ZONE.