Wednesday, January 09, 2013 9:40 PM
I read this on MSDN: "(GetDate) --- Returns the current database system timestamp as a datetime value without the database time zone offset.".
What does the "time zone offset" refer to? Whenever I use getdate() it returns the proper time for my location (i.e. GMT -8)
Wednesday, January 09, 2013 10:14 PMModerator
What is your SQL Server version?
select SYSDATETIME(), getdate(), GETUTCDATE()
and help for
GETDATE() returns your server's local time.
For every expert, there is an equal and opposite expert. - Becker's Law
- Edited by Naomi NMicrosoft Community Contributor, Moderator Wednesday, January 09, 2013 10:15 PM
Wednesday, January 09, 2013 10:28 PMSorry I forgot to mention it! Sql 2008
Wednesday, January 09, 2013 10:38 PMModerator
The offset is not filled automatically:
SELECT SYSDATETIME() AS SYSDATETIME; -- 2013-01-09 22:33:43.5390546 SELECT SYSDATETIMEOFFSET() AS SYSDATETIMEOFFSET; -- 2013-01-09 22:33:43.5390546 +00:00 SELECT SYSUTCDATETIME() AS SYSUTCDATETIME; -- 2013-01-09 22:33:43.5390546 SELECT CURRENT_TIMESTAMP AS [CURRENT_TIMESTAMP]; -- 2013-01-09 22:33:43.537 SELECT GETDATE() AS GETDATE; -- 2013-01-09 22:33:43.537 SELECT GETUTCDATE() AS GETUTCDATE; --2013-01-09 22:33:43.537
It can be set like:
Wednesday, January 09, 2013 10:58 PM
What they are trying to say is that the value returned does not indicate in which time zone the value relates to. This is in difference to sysdatetimeoffset().
Erland Sommarskog, SQL Server MVP, email@example.com
- Marked As Answer by edm2 Thursday, January 10, 2013 1:12 AM