T-SQL 101: 68 Current date and time in SQL Server T-SQL with SYSDATETIME and SYSDATETIMEOFFSET
It’s really common to need to know the current date and time in T-SQL code. Ever since the beginning of the SQL Server product, we’ve had a function called GETDATE(). It returns the current date and time of the server as a datetime value.
In SQL Server 2008, we got new higher precision data types, and so new current date and time functions were added as well.
SYSDATETIME() is a function that returns the current date and time as a datetime2 value. And SYSDATETIMEOFFSET() returns the timezone offset for the server as well.
2020-05-04
