You are on page 1of 1

description:

if the week ending day is saturday, how do you calculate the following saturday
based on the current date. for example, if today is 9/29/05, how would you
calculate that next saturday is 10/01/2005.

solution:

add this calculation to the report. this will calculate the date until the end of
saturday, which is 11:59:59 pm.

case
when _day_of_week ( current_date ,1)=1 then
_add_days(current_date,6-(1/24/60/60))

when _day_of_week ( current_date ,1)=2 then


_add_days(current_date,5-(1/24/60/60))

when _day_of_week ( current_date ,1)=3 then


_add_days(current_date,4-(1/24/60/60))

when _day_of_week ( current_date ,1)=4 then


_add_days(current_date,3-(1/24/60/60))

when _day_of_week ( current_date ,1)=5 then


_add_days(current_date,2-(1/24/60/60))

when _day_of_week ( current_date ,1)=6 then


_add_days(current_date,1-(1/24/60/60))

else _add_days(current_date,7)

You might also like