Work out the previous Sunday


#1

Hi,

Is there a way I can work out the previous Sundays date. Throughout the week my automation will run and I need to be able to enter in Sundays date each time.

Thanks


Date PreviousMonths FirstDayofWeek and LastDayOfWeek
#2

How about getting DayOfWeek number by using Weekday() function (If it’s Sunday it returns 1 and if Saturday it returns 7).
Then you need just add 7 to current date when it’s Sunday, or you’ll need to add 6 if it’s Monday.

Like this:
nextSunday = Today.AddDays(8 - Weekday(Today))

With following example you can get next Sunday of any input date.

get date of next Sunday.zip (2.3 KB)


#3

Building on what @a-Taniya has stated, if you wanted to acquire the previous Sunday’s date you could use:
Today.AddDays(- (Weekday(Today) - 1))

26/06/17 - (2 - 1) = 25/06/17


#4

Thanks Mr_JDavey, I was mixed up while crafting sample flow! :sweat_smile:


#5

Thanks for the reply. It worked great. Thanks.