Handout 6 - Lecture Notes
Handout 6 - Lecture Notes
DateTime Functions
1 DateAdd
Add 2 months to titles.pubdate
Show how this can also be used to subtract from a date – subtract 1 month from the
pubdate (use a negative value for the number paramter)
2 DateDiff
Find how many years since each title was published
Find how many months since each title was published
3 Datepart
Find the week number of the current date
Find the day number for the current date
Find the day of year number for the current date
Find the week day number for the current date
(point out the difference between day, dayofyear and weekday – day is 1-31,
dayofyear is 1 – 366, weekday is 1-7)