Hi,
I’d like to ask. How to get yesterday’s file (filename format yyyyMMdd) but only Monday to Friday (Saturday and Sunday holidays). When I use “DateTime.Now.AddDays(-1).ToString((“yyyyMMdd”)" in assign activity, When Monday will still search for data on Sunday. how do you do it on Monday, the robot automatically searches for Friday? thank you
Hi @wsinten
I can try to use Switch activity and set System.DayOfWeek to the TypeArgument like below.
Default: DateTime.Now.AddDays(-1).ToString(“yyyyMMdd”)
Case Monday: DateTime.Now.AddDays(-3).ToString(“yyyyMMdd”)
Hi,
Can you the following expression? This returns date of previous Friday, if input is Monday or Sunday.
DateTIme.Now.AddDays(-1+2*CInt(DateTime.Now.DayOfWeek=DayOfWeek.Monday)+CInt(DateTime.Now.DayOfWeek=DayOfWeek.Sunday)).ToString("yyyyMMdd")
Regards,
Hi @wusiyangjia,
I will try your code. thanks for helping me.
hi @Yoichi,
Thanks for helping me. Your code works for my worksheet. thank you sir.
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.