SQL Server
How to get Date only from the datetime value?
SELECT CONVERT(VARCHAR(10), getdate(), 101); Outputs in mm/dd/yyyy SELECT CAST(getdate() AS date); To get the current date time: SELECT getdate(); SELECT CURRENT_TIMESTAMP; Other related functions: ELECT CONVERT (time, SYSDATETIME()) ,CONVERT (time, SYSDATETIMEOFFSET()) ,CONVERT (time, SYSUTCDATETIME()) ,CONVERT (time, CURRENT_TIMESTAMP) ,CONVERT (time, GETDATE()) ,CONVERT (time, GETUTCDATE()); /* Returned SYSDATETIME() 13:18:45.3490361 SYSDATETIMEOFFSET()13:18:45.3490361 SYSUTCDATETIME() 20:18:45.3490361 Read more…