SQL Server - DAY() , MONTH(), YEAR() Functions

SQL Server Day, Month, Year Functions

If you need to extract a portion of the date you can use one of these three functions. You can also use the datepart or datename functions to accomplish the same task. Note that the DAY() and Month() functions will return the the respective day or month without a leading zero.

   DAY(GETDATE())       AS "DAY()" 
  ,YEAR(GETDATE())      AS "YEAR()"   
FROM AdventureWorks2008R2.Sales.Store
 Collapse All    Expand All
Custom Search

SQL Server Information and Resources