sql week code example
Example 1: get hour from date sql
SELECT DATEPART(HOUR, GETDATE());
Example 2: sql server week number
datepart(wk, DateToParse)
Example 3: sql last week
select min(date), max(date)
from calendar
where week = datepart(week, getdate() - 7)
and year = datepart(year, getdate() - 7)