I want to add 2 business days to certain date by excluding saturday and sunday
any suggestions how to do this
I want to add 2 business days to certain date by excluding saturday and sunday
any suggestions how to do this
Hi @vikram ,
Just to reclarify, you want addition of 2 business days in the current date and this should not consider Weekends. Say if friday is your date addition should give you tuesday. Right ?
have a view on this thread.
Regards,
NaNi
yes , it should be Tuesday in case of Friday
Hi @vikram
Try out this below syntax
create a new datetime variable Ex:newdate
newdate=yourdatevariabble.AddDays(2)
newdate=if(newdate.DayOfWeek=6,variable1.AddDays(4),if(newdate.DayOfWeek=7,variable1.AddDays(3),variable1.AddDays(2)))
It will exclude saturday and sunday
use newdate variable where you want to use
Hope is solves your issue
update us whether you got your desired answer or not
thanks,
Robin
we can compact it by following:
myDateTime.AddDays({3,2,2,2,4,4,3}(myDateTime.DayOfWeek))
myDateTime is of DataType: DateTime - e-g- Now
Test series:
Find starter help here:
GetNextWorkDayWithOffset.xaml (6.4 KB)
Hi
Can you explain this line myDateTime.AddDays({3,2,2,2,4,4,3}(myDateTime.DayOfWeek)) . I want to add 17 business days for given datetime. Can you please explain what I need to modify in that line.
Thanks In Advance
just modify the array with the offset
{3,2,2,2,4,4,3}
3 for sunday
2 for Mon,Tue, Wed
4, Thu, Fri
3, Sat
myDateTime.DayOfWeek will return 0 for sun, 1 for mon…6 for sat
So configured, the offset for each day will be accessed by index
could you send me the array offset for next 17 days excluding sat and sun.
Thank you SO much! This was so easy to use. You rock!