I need to know whether SQL
GETDATE()
displays actual current date or system date ?
Asked
Active
Viewed 1,564 times
-2

Andrey Korneyev
- 26,353
- 15
- 70
- 71

Abdul
- 2,002
- 7
- 31
- 65
2 Answers
2
It is clearly said in MSDN:
getdate() returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.

Andrey Korneyev
- 26,353
- 15
- 70
- 71
-
Thank you @Andy Korneyev – Abdul Jul 28 '16 at 04:43
1
As far as I know there are six SQL Server date functions, all of them derive current date from operating system (Is it possible to get date from outside? Is it possible to have more than one date on the same computer?). The differences are in timezones and their interpretation. Take a look at this query:
SELECT 'SYSDATETIME' [Name], SYSDATETIME()
UNION ALL
SELECT 'SYSDATETIMEOFFSET', SYSDATETIMEOFFSET()
UNION ALL
SELECT 'SYSUTCDATETIME', SYSUTCDATETIME()
UNION ALL
SELECT 'CURRENT_TIMESTAMP', CURRENT_TIMESTAMP
UNION ALL
SELECT 'GETDATE', GETDATE()
UNION ALL
SELECT 'GETUTCDATE', GETUTCDATE();
On my computer this yields:
SYSDATETIME 2016-07-27 13:44:12.8562698 +00:00
SYSDATETIMEOFFSET 2016-07-27 13:44:12.8562698 +02:00
SYSUTCDATETIME 2016-07-27 11:44:12.8562698 +00:00
CURRENT_TIMESTAMP 2016-07-27 13:44:12.8530000 +00:00
GETDATE 2016-07-27 13:44:12.8530000 +00:00
GETUTCDATE 2016-07-27 11:44:12.8530000 +00:00
My advice is to analyze this script, see differences and read MSDN Documentation about those functions.

Paweł Dyl
- 8,888
- 1
- 11
- 27