2 Replies Latest reply on Feb 8, 2011 9:54 AM by jonnyt

# Calculation to work out the date of each day in the current week

### Title

Calculation to work out the date of each day in the current week

### Post

I am UK based and have a date format of DD/MM/YYYY

Can anyone help me with a calculation as follows:-

I need to work out the date of each working day in the current week.

For example:-
Todays Date is: 01/02/2011 and Today is Tuesday
Monday = 31/01/2011
Tuesday = 01/02/2011
Wednesday = 02/02/2011
Thursday = 03/02/2011
Friday = 04/01/2011

Calculations can be in seperate fields so that there is one field per day calculation.

i.e.

thisWeeksMonday
thisWeeksTuesday....... etc etc

I basically want to have 5 seperate reports or portals which are filtered by each day: Monday, Tuesday, Wednesday, Thursday, Friday

• ###### 1. Re: Calculation to work out the date of each day in the current week

You know what the day number of the week today is, by using the DayOfWeek function. (Sunday is Day 1.)  So you can add or subtract the number of days from today to work back or forward through the week.

For example, Monday's date will be (assumes that the week starts on Sunday):

MondayDate = Get ( CurrentDate ) + ( 2 - DayOfWeek ( Get ( CurrentDate ) ) )

TuesdayDate = Monday + 1 (obviously)

Note that this will update every time you open the file or change record.  Might be better to set it once by a script, and let the date fields be indexed.

If all you want to do is filter by 'Monday', Tuesday', etc (as opposed to the 1/2/2011, 2/2/2011), then why not just filter by the DayName?

• ###### 2. Re: Calculation to work out the date of each day in the current week
excellent thanks!