GETUTCDATE function is used to get the current universal time coordinate. It is derived from the current local time and the time zone setting in the operating system of the computer on which sql server is running.
Syntax of GETUTCDATE Function :
GETUTCDATE()
Return type of GETUTCDATE is datetime.
Example of GETUTCDATE Function :
Example 1 : Use of GETUTCDATE function in select clause
SELECT GETUTCDATE()
Output
2002-08-02 20:22:41.630
Above example displays a current date.
Example 2 : Use of GETUTCDATE function in where clause
SELECT ShipName, OrderDate
FROM Orders
WHERE DATEPART(MONTH,OrderDate) = DATEPART(MONTH,GETUTCDATE())
Output
ShipName OrderDate
Wartian Herkku 1996-08-01 00:00:00.000
Split Rail Beer & Ale 1996-08-01 00:00:00.000
Rattlesnake Canyon Grocery 1996-08-02 00:00:00.000
QUICK-Stop 1996-08-05 00:00:00.000
Above example displays all orders having same month returned by GETUTCDATE function.