Here is a quick video tutorial on how to use the T-SQL GetDate function on SQL Server 2012, SQL Server 2014 or newer. This was originally part of my free SQL query training for the 70-461 certification exam.
Here is the sample code that goes with the video.
-- GETDATE()
SELECT GETDATE();
-- GETDATE just as a TIME
SELECT CONVERT (time, GETDATE());
-- comparing GETDATE() to others
SELECT CONVERT (time, GETDATE()) AS [getDate],
CONVERT (time, SYSDATETIME()) AS [sysDateTime],
CONVERT (time, SYSUTCDATETIME()) AS [sysUtcDateTime],
CONVERT (time, CURRENT_TIMESTAMP) AS [current_timestamp],
CONVERT (time, GETUTCDATE()) AS [getUtcDate];
See Also
- Additional Training on my YouTube Channel
- Free SQL Query Training
- 70-461 exam preparation
More from Stedman Solutions:
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!