When is the next Monday?


Hi all, I'm trying to get the next Monday to occur, given CurrDate().

If CurrDate() is a Monday then it would return the Monday 7 days from now.

The trick is that I'm trying to get this in an expression, rather than a client action with a load of loops and Ifs. Is this possible?


Damn, got logged out while writing the post. Anyway, this formula should work:

AddDays(CurrDate(), 7 - Mod(DayOfWeek(CurrDate()) + 6, 7))

Note that if you ever plan to run that code around midnight, be sure to first put the current date in a Local Variable and use that, as otherwise you get wrong results if the date just happens to flip over halfway the execution...


Kilian, thank you once again. I'd got as far as 

AddDays(CurrDate(),Mod(1 - (DayOfWeek(CurrDate()) + 7) , 7))

Maths is not my strong suit, so thank you so much!!

You're welcome :). In cases like this, I like to take Excel and fiddle around a bit :).

That's a cracking idea. I had used CurrDate() as an input variable to the expression so i could select different dates from an input box and watch my calculations go increasingly awry!