Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Date Time FunctionsRSS Feeds

GETUTCDATE Function

Posted By: Sarita Patel     Category: SQL Server     Views: 2707

This article describes the use of GETUTCDATE function in sql server with different examples.

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.
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on GETUTCDATE Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of GETUTCDATE Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!