Answer: declare @start_date DATETIME
SET @start_date=dateadd(week, datediff(week, 0, getdate()), 0) ;
-- Get the last date of the last week
declare @end_date DATETIME
SET @end_date=dateadd(week, datediff(week, 0, getdate()), 6) ;
select
CONVERT(VARCHAR(10),@start_date,105) 'start day date of the week',
CONVERT(VARCHAR(10),@end_date,105) 'end day date of the week'
CONVERT(VARCHAR(10),@start_date,105) : This is used for removing the time part from the DateTime data type.
Found interesting? Add this to: