How to count the week End Day ?

Discussion created by fawad001 on Aug 4, 2017
Latest reply on Aug 4, 2017 by fawad001


My scenario is to set the week start and end day by clicking a single button, so how would I calculate the days week start date and week end date?


for the week starting and ending date,  I am using...

For Week End Date : $WeekEndDate = Get ( CurrentDate ) + (7 - DayOfWeek ( Get ( CurrentDate ) ) ) + 1

For Week Start Date:$WeekStartDate = $WeekEndDate - 6


These formulae are working fine on the following days "From Monday to Saturday" but when I click on Sunday it jumps to the next week days which make sense because the dayofweek for sunday is "1" but my requirement is when user although click on Sunday, the start and end date must meet the current week dates.


Looking forward to the answer.


Thanks in advance.