First and Last Day of Week - SQL
Many times you might come across to a situation where you have to find the first and last day of week. Here is the SQL script which can be used to find the first and last day of the week. --Start of Script DECLARE @date datetime -- Will be the date for which you want to have the Start and End of week DECLARE @end_week datetime -- End of week DECLARE @start_week datetime -- Start of week. SET @date = getdate() SET @start_week = DATEADD(d, 1 - DATEPART(dw, @date), @date) SET @end_week = DATEADD(d,6,@start_week ) SELECT @date, @start_week, @end_week --End of Script