Capture Next Week Date

Hi All,

This might be a simple question and hopefully a very simple solution. I can’t for some reason get my head around this.

I have a spreadsheet with two columns. Column 1 has Dates and Column 2 has Names. All the dates are Thursdays.

I’m using For Each Row loop from Read Range data table.

I want:
IF today is 21/04/2022
Check if Thursday date 28/04/2022 exists
IF TRUE then Sweet!
IF FALSE then send an email to notify
The rows will grow. Additional dates will continue to be added and deleted.

The end result is to process automation then check and notify by email if the next Thursday date from today exists. That way additional dates should be added.

image

Hi @j8zel

I understand that you will iterate through data table with for each, within for each
Pseudo Code

String `CurrentRow_date` = "31/03/2022"
DateTime` Day_wk` = DateTime.ParseExact(`CurrentRow_date`,"dd/MM/yyyy",nothing) --> this converts String type date to DateTime type
IF ` Day_wk`.DayOfWeek.ToString.Equals("Thursday")
    then Send mail

Hope this is helpful. If this solves mark this as solution to help others with similar issues

1 Like

sounds like as a part of flow you want to calculate the next Thursday from a given date.

do the parsing as described above

the next thursday calculation we can do as following (rule, if today is thursday take next week thursday)

grafik


 Enumerable.Range(1,7).Select(Function (x) Now.AddDays(x)).Where(Function (d) d.DayOfWeek = 4).First()
 [03/31/2022 10:28:03]

Instead of Now you can also use any other DateTime variable

Enumerable.Range(1,6).Select(Function (x) YourDateTimeVar.AddDays(x)).Where(Function (d) d.DayOfWeek = 4).First()
2 Likes

That worked. Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.