Find date?

If I want to find date before 3 day (not count holiday)

*I read date holiday by file excel as below.

holidays.xlsx (13.1 KB)
WorkingORnot.xaml (12.9 KB)

Example : today 20/05/2021
but in file holiday 20/05/2021 as holiday.
I want to find by count the days back 3 day.
Output : 17/05/2021

Please guide me about it.

@fairymemay,

Try with this workflow, I have downloaded your xlsx and updated for today’s date in it to test the workflow.

ListCheckDate.xaml (9.0 KB)

@sarathi125 No, I want to find back 3 day not count day = holiday.

Example :
If in excel 19/05/2021 and today (21/05/2021) = holiday.

Input : today (21/05/2021) not count because holiday
round 1 = 20/05/2021 count day +1
round 2 = 19/05/2021 not count because holiday
round 3 = 18/05/2021 count day +1
round 4 = 17/05/2021 count day +1

I want Output show : 17/05/2021

Please guide me more.

@fairymemay ,

Then change this as 4 instead of 3 in that line

date1.AddDays(-4).ToString
1 Like

@fairymemay - I have already shared the post which has the solution to this problem.

When you say Holiday it means local holiday so you have to prepare a list first.

@sarathi125 I think I can’t specific 4.
Bacause if 3 day back vert not in holiday (from 19/05/2021 to 21/05/2021) not in holiday I want show output 19/05/2021.

But If date from 19/05/2021 to 21/05/2021 have 1 holiday —> I want back vert date 4 day

It will work

@prasath17 Yes, Holiday mean local holiday.
I have prepare file excel already.

But I want find three days of previous days, excluding holidays.

**Check holiday by file excel
holidays.xlsx (13.1 KB)

Please​ guide​ me​ more.

@fairymemay - Have you added this to dictionary as mentioned in the post…???

@prasath17 Yes, I use .xaml as your mentiond.
But this .xaml is check today as holiday or working only.

But I want find 3 previous day (by all 3 day are working day)

You have to build a logic to check each in your duration is holiday…if yes then add (-3)…and if not add(-4) something like this…

@prasath17 I want logic and output as below.

image

Any idea?

Only till 3 day will be there or it can have more?

@Divyanshu_Divyanshu Depending on whether it on a holiday or not.
If in 3 days​ have​ holiday​—>it​ more​ than3

3DaysBack.xaml (7.1 KB)

I used one of your last examples:

  • 18 and 19 are public holidays
  • Input Date is 21/05/2021
  • Output Date is 16/05/2021

You can have the public holidays in a list or you can read them from an excel file and convert the datatable column to a list.

It does not check for weekends but you can easily adjust it if you want.

Something like:
DateTime InputDate
Int X =0
List (DateTime) PreviousDates
List (DateTime) LocalHolidays

While X < 3 {
If LocalHolidays.exists(InputDate)
InputDate = InputDate -1
Else
PreviousDates.add(“InputDate”)
X=X+1
InputDate = InputDate -1
}

@dimibot If Iwant read public holiday from excel column Date to String
Please guide me about it.

holidays.xlsx (13.1 KB)

Please mark solved if it solves your problem:

For each CurrentRow in DataTable
Temp = DateTime.Parse(CurrentRow.Item(0).ToString)
Temp = Temp.AddDays(-3)

It is worth noting that Temp variable should be type DateTime to add days

Testing.xaml (7.9 KB)

@Sarmad_Nadeem Logic and output as below.
image

Check holiday from excel : holidays.xlsx (13.1 KB)

Please guide me.