Use a Let statement to make it easy to set out the different components:
Let ( [ firstDayOfWeek = 2 /* Sun = 1, Mon = 2, etc */ ; aDate = get(currentdate) ; daysUntilNextWeek = ( 7 + firstDayOfWeek ) - dayofweek( aDate ) ; NextWeekStart = aDate + daysUntilNextWeek ; NextWeekEnd = NextWeekStart + 6 ]; getastext( NextWeekStart ) & "..." & getastext( NextWeekEnd ) )
here's an other version:
Let ( [
_date = Get ( CurrentDate ) + 7 //date in 1 week
; _weekday = Choose ( DayOfWeek ( _date ) - 1 ; 6 ; 0 ; 1 ; 2 ; 3 ; 4 ; 5 ) //weekday cero-based (6 = sunday)
; _start = _date - _weekday //if today is sunday: _date - 6 = tomorrow
; _end = _start + 6
_start & "…" & _end
Thanks Otmar and everyone.
Otmar - would that completely replace my calculation? Just want to be sure I understand... your calculation will return next week (with the week starting Monday and ending sundae).
Thanks again. This forum is always helpful!
Yes, it should work as intended. Just put it in the data viewer and set the _date to several test-dates (leave the + 7 behind).
If you define the start of next week if lets say today is sunday as the following day means next day, the formula should be correct, if it should be a week later, just replace "+ 7" with "+ 14".