graham

Day of the Week Number

Blog Post created by graham on May 29, 2018

Many people have requested a method of finding the date of the Monday in a week.

I have seen several quite complex solutions, but then I read this post https://community.nintex.com/thread/11519 and realised it is a trivial matter.

Firstly, create a collection of the 3-letter day abbreviations (this should be done for your current locale, for other locales use the appropriate 3-letter day name abbreviations) and should be in uppercase. The easiest way is to use a Regular Expression and split

MON;TUE;WED;THU;FRI;SAT;SUN

around the ‘;’ character.

Regex - Split

Then add a collection operation that tests if fn-ToUpper(fn-FormatDate(DoWDate,ddd)) exists in the collection of days, returning the result in a number variable DoWNum.

Collection operation

If you now subtract DoWNum from the given ‘DoWDate’, you will have the Monday date.

Outcomes