Archive for the ‘T-SQL’ Category

Hot to get the current date in T-SQL

Şubat 13, 2017

SELECT SYSDATETIME() as SYSDATETIME,
SYSDATETIMEOFFSET() as SYSDATETIMEOFFSET,
SYSUTCDATETIME() as SYSUTCDATETIME,
CURRENT_TIMESTAMP as “CURRENT_TIMESTAMP”,
GETDATE() as GETDATE,
GETUTCDATE() as GETUTCDATE,
CAST(GETDATE() As date ) CAST,
CONVERT (date, GETDATE()) as “CONVERT”;

 

SYSDATETIME 2017-02-13 17:16:16.0697359
SYSDATETIMEOFFSET 2017-02-13 17:16:16.0697359 +03:00
SYSUTCDATETIME 2017-02-13 14:16:16.0697359
CURRENT_TIMESTAMP 2017-02-13 17:16:16.067
GETDATE 2017-02-13 17:16:16.067
GETUTCDATE 2017-02-13 14:16:16.067
CAST 2017-02-13
CONVERT 2017-02-13