Find todays date & time in SQL Server part 2

Have you ever wanted to return the time found in GETDATE or CURRENT_TIMESTAMP to a higher level off accuracy in SQL? Well I am going to show you how.

The other day I needed to get the current time to greater accuracy due to the time stamp given to some records and I had to use the following functions which give the time to the millisecond.

SELECT SYSDATETIME ()             —     System time and date

SELECT SYSDATETIMEOFFSET ()       —     The time is included.

SELECT SYSUTCDATETIME ()          —     The date and time is returned as UTC time

1

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: