Hi All,
Can any one help me to extract the 2 days older date from current date in calender excluding Holidays and weekends(Sat,Sun).
For Example: current date = 26/02/2024
result date = 23/02/2024
if in case 23/02/2024 is fall under holiday then
result date = 22/02/2024
Please guide me how to do this?
rlgandu
(Rajyalakshmi Gandu)
February 26, 2024, 6:00am
2
@yashashwini2322
resultDate = Enumerable.Range(1, 2 + If(DateTime.Now.DayOfWeek = DayOfWeek.Monday, 2, If(DateTime.Now.DayOfWeek = DayOfWeek.Sunday, 1, 0))).
Select(Function(i) DateTime.Now.AddDays(-i)).
FirstOrDefault(Function(d) Not (d.DayOfWeek = DayOfWeek.Saturday OrElse d.DayOfWeek = DayOfWeek.Sunday)).
ToString("dd/MM/yyyy")
Lak_Ui
(Lakshmi)
February 26, 2024, 6:12am
3
Hi @yashashwini2322
Assign resultDate = Now.AddDays(-2)
Check resultDate.DayOfWeek = DayOfWeek.Saturday
then resultDate=Now.AddDays(-1)
Else if resultDate.DayOfWeek = DayOfWeek.Sunday
resultDate=Now.AddDays(-2)
Thanks,
Lakshmi
vrdabberu
(Varunraj Dabberu)
February 26, 2024, 6:12am
4
Hi @yashashwini2322
Do you have the list of holidays in a excel.
Regards
yes.
Calender.xlsx (12.0 KB)
this is the sample calender for February 2024 with holiday and weekend list.the file will contains all the months data untill 2030.
1 Like
vrdabberu
(Varunraj Dabberu)
February 26, 2024, 6:52am
6
Hi @yashashwini2322
Check out the below xaml file. Hope this meets your requirement.
Sequence2.xaml (11.0 KB)
Regards
Can you zip the process and share it,not able to open it
vrdabberu
(Varunraj Dabberu)
February 26, 2024, 7:07am
8
Hi @yashashwini2322
Check the below zip file. Hope this meets your requirement.
BlankProcess18.zip (198.6 KB)
Regards
Sorry to mention,
for 20/02/2024 the result date should be 16/02/2024 but it is wrongly picking 17/02/2024
vrdabberu
(Varunraj Dabberu)
February 26, 2024, 10:05am
10
Hi @yashashwini2322
Check the below zip file. Hope this meet your requirement.
BlankProcess18.zip (214.3 KB)
Regards