|
SELECT
GETDATE() as 'GetDate',
DAY(GETDATE()) as 'Day',
MONTH(GETDATE()) as 'Month',
YEAR(GETDATE()) as 'Year',
GETUTCDATE() as 'UTC',
DATEADD(DAY,1, GETDATE()) as 'DateAdd',
DATENAME(MONTH, GETDATE()) as 'DateName',
DATEPART(WEEK, GETDATE()) as 'DatePart',
DATEDIFF(YEAR,'05-30-1980',GETDATE()) as 'DateDiff'
|
Output |
GetDate |
Day |
Month |
Year |
UTC |
DateAdd |
DateName |
DatePart |
DateDiff |
2013-06-06 12:02:51.727 |
6 |
6 |
2013 |
2013-06-06 16:02:51.727 |
2013-06-07 12:02:51.727 |
June |
23 |
33 |
|