SYSUTCDATETIME() vs GETUTCDATE() in SQL Server: What’s the Difference?

SYSUTCDATETIME() and GETUTCDATE() are two T-SQL date/time functions available for use in SQL Server.  These functions return the date and time of the computer on which the instance of SQL Server is running. Both functions return the date and time as UTC time (Coordinated Universal Time).

So, both functions do the same thing. Almost.

Here’s how these two functions differ:

  • GETUTCDATE() returns its value as a datetime value.
  • SYSUTCDATETIME() returns its value as a datetime2 value.

This means that SYSUTCDATETIME()  provides more seconds precision. The datetime2 data type also has a larger range than datetime.

Example

Here’s an example to demonstrate the value returned by each function:

SELECT 
    GETUTCDATE() AS GETUTCDATE,
    SYSUTCDATETIME() AS SYSUTCDATETIME;

Result:

+-------------------------+-----------------------------+
| GETUTCDATE              | SYSUTCDATETIME              |
|-------------------------+-----------------------------|
| 2018-06-13 11:04:55.237 | 2018-06-13 11:04:55.2396676 |
+-------------------------+-----------------------------+

So this is similar to the difference between SYSDATETIME() and GETDATE().

Which One Should I Use?

Microsoft recommends that we use datetime2 with our date/time values. This data type aligns with the SQL standard, and is more portable than datetime.

Therefore, use SYSUTCDATETIME() unless you have a specific reason not to.