Determine current date with different option TIP #16

We can determine date with different option in SQL server

Option 1:– with GETDATE() we can get current date & time
Go
  SELECT GETDATE()
GO

Option 2:- With sysDateTime()  , we can get current date & time (with nano seconds)
GO
   SELECT SYSDATETIME()
GO


Option 3:- with SYSDATETIMEOFFSET() , We can get current date & time with timezone offset
Go
  SELECT SYSDATETIMEOFFSET()
Go

Option 4:- with SYSUTCDATETIME() , We can get current date & time with UTC (Coordinated Universal Time)

GO
  SELECT SYSUTCDATETIME()
GO



Option 5:-
with GETUTCDATE() , We can get current date & Time with UTC
GO
  SELECT GETUTCDATE()
GO

 
Option 6:- with CURRENT_TIMESTAMP , we can get current date & Time
GO
  SELECT CURRENT_TIMESTAMP
GO

Enjoy !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code