Advertisement
murp

SQL DateParts

Aug 28th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.34 KB | None | 0 0
  1. -- MS SQL Datepart methods
  2. DATEPART(year, GETDATE()) as 'Year',
  3. DATEPART(month,GETDATE()) as 'Month',
  4. DATEPART(day,GETDATE()) as 'Day',
  5. DATEPART(week,GETDATE()) as 'Week',
  6. DATEPART(hour,GETDATE()) as 'Hour',
  7. DATEPART(minute,GETDATE()) as 'Minute',
  8. DATEPART(second,GETDATE()) as 'Seconds',
  9. DATEPART(millisecond,GETDATE()) as 'MilliSeconds'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement