Level 11 Level 13
Level 12

Working with the datetime data type


18 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
'YYYYMMDD HH:MM:SS.MMM'
A full datetime value in SQL
DATEPART(DATEPART, DATE)
A function to return an integer datepart value from a date.
DATEPART
Is the part of date (a date or time value) for which an integer will be returned
YYYY
Datepart argument for a year
Q
Datepart argument for a quarter
MM
Datepart argument for a month
DY
Datepart argument for a dayofyear
DD
Datepart argument for days
WK
Datepart argument for a week
HH
Datepart argument for an hour
MINUTE
Datepart argument for a minute
SS
Datepart argument for seconds
GETDATE()
This function shows the current datetime in a valid date format, it does not require an argument
DATEADD(DATEPART, INTEGER, DATE)
A function to add or substract time. Requires an argument, integer and a date
SELECT GETDATE()
Query returning the current date & time
SELECT DATEPART(WW, GETDATE())
Query returning the current week (ww)
SELECT DATEDIFF(DAY, GETDATE(), DATEADD(MM, 2, GETDATE()))
Query returning the difference in days between now and 2 months from now. Use mm as the datepart argument
DATEDIFF(DATEPART, STARTDATE, ENDDATE)
A function returning an integer value of a part of a date between 2 dates