-1

'10/10/2018' is the given date, I want to find week start date in which this date falls..according to calendar

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
D.Jones
  • 25
  • 5

3 Answers3

0

You can get the first day of the week like following.

 declare @inputdate date='10/10/2018'
 select DATEADD(dd, -(DATEPART(dw, @inputdate)-1), @inputdate) [WeekStart]

If you want to change the first day of week to a specific day, for this you can use SET DATEFIRST

SET DATEFIRST 7
declare @inputdate date='10/10/2018'
select DATEADD(dd, -(DATEPART(dw, @inputdate)-1), @inputdate) [WeekStart]

SET DATEFIRST

PSK
  • 17,547
  • 5
  • 32
  • 43
0

You can try below -

select DATEADD(dd, -(DATEPART(dw, '10/10/2018)-1), '10/10/2018)
Fahmi
  • 37,315
  • 5
  • 22
  • 31
0

Please try this query:

SELECT DATEADD(DAY, 2 - DATEPART(WEEKDAY, '10/10/2018' ), CAST('10/10/2018' AS DATE)) [Week_Start_Date] 
Eriawan Kusumawardhono
  • 4,796
  • 4
  • 46
  • 49
Hemang A
  • 1,012
  • 1
  • 5
  • 16