Find todays date & time in SQL Server part 2 — Parv The IT Geek

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


Originally published at https://parvtheitgeek.com on February 9, 2014.

Advertisement

Published by Parvinder Nijjar

I blog at ParvTheITGeek.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: