SQL Server/T-SQL Tutorial/Date Functions/Day
Displaying the Integer Value For Part of a Date using DAY
<source lang="sql">
3> 4> SELECT DAY(GETDATE()) 5> GO
19
(1 rows affected) 1></source>
select DAY("2002-09-30")
<source lang="sql">
2> select DAY("2002-09-30") 3> GO
30
(1 rows affected) 1></source>
YEAR, MONTH, DAY
<source lang="sql">
5> 6> SELECT "Year: " + CONVERT(VarChar(4), YEAR(GETDATE())) 7> ", Month: " + CONVERT(VarChar(2), MONTH(GETDATE())) 8> ", Day: " + CONVERT(VarChar(2), DAY(GETDATE())) 9> 10> GO Msg 102, Level 15, State 1, Server J\SQLEXPRESS, Line 7 Incorrect syntax near "+".</source>