Difference between Getdate() and GetUTCDate() | SansSQL

Wednesday, November 17, 2010

Difference between Getdate() and GetUTCDate()


GETDATE()
GETDATE()
 function returns the current database system timestamp. This value is derived from the operating system of the computer on which the instance of SQL Server is running. 
If you are connected to the SQL server remotely then the timestamp displayed will be the timestamp of the SQL server machine and not your local machine.
UsageSELECT GETDATE() as [ServerTime]


GETUTCDATE(): 
GETUTCDATE() function returns the current UTC time. This value is derived from the operating system of the computer on which the instance of SQL Server is running. 
This can be used to store the timestamp that is independent of Time Zones.

Usage
SELECT GETUTCDATE() as [UTCTime]

No comments:

Post a Comment