{"id":18,"date":"2011-06-28T04:32:23","date_gmt":"2011-06-28T04:32:23","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2011\/06\/28\/retreive-current-date-time-getdate-sysdatetime-sysdatetimeoffset-sysutcdatetime-current_timestamp-getutcdate\/"},"modified":"2011-06-28T04:32:23","modified_gmt":"2011-06-28T04:32:23","slug":"retreive-current-date-time-getdate-sysdatetime-sysdatetimeoffset-sysutcdatetime-current_timestamp-getutcdate","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2011\/06\/28\/retreive-current-date-time-getdate-sysdatetime-sysdatetimeoffset-sysutcdatetime-current_timestamp-getutcdate\/","title":{"rendered":"Fetch current date time in SQL Server"},"content":{"rendered":"
SQL SERVER CURRENT DATE TIME<\/strong><\/p>\n How To Retrieve The Current Date Time in SQL Server?<\/p>\n There are many in built functions provided by the SQL Server which can be used to fetch the current date time. In order to fetch the current date time in SQL server the following Date and Time Functions can be used:<\/p>\n <\/span> <\/span> <\/span> <\/span> <\/span> <\/span> <\/span><\/p>\n Advanced Details:<\/strong><\/p>\n All the above functions use the windows API GetSystemTimeAsFileTime()<\/strong> to fetch the current data time. The precision for this API is fixed to ~100 Nano seconds.<\/p>\n Date time Functions SYSDATETIME (), SYSDATETIMEOFFSET(), SYSUTCDATETIME()<\/strong> are high precition functions and the functions CURRENT_TIMESTAMP, GETDATE(), GETUTCDATE()<\/strong>are low precision functions.<\/p>\n All the above functions have the same output in the query analyzer as shown in the below image:<\/p>\n
\nThe date time that is fetched by these functions would be the date time of the server on which the SQL Server is installed. The time zone also corresponds to the Server On which the SQL Server is installed.<\/p>\n\n