Hope someone can help. as topic header states, is it possible to output a date 2 days ahead of today’s date but exludes weekend days I.E date is 07/08/2020 (last friday) and you wanted to display the date that would be 2 days ahead BUT doesn’t include weekend days so - 11/08/2020 (Tuesday) in a text format?
Well this now.ToString("ddd-MM-yyyy") will give you, Sun-08-2020
There’s really a lot of ways to do this, check Microsoft .NET DateTime formats. anyways you can use an if to check if Not DateVar_Str.Contains("Sat") Or Not DateVar_Str.Contains("Sun")
and then convert date back to what you want and use the AddDays(2) function get two days ahead. for example: this now.AddDays(2).ToString("ddd-MM-yyyy") will give you Tue-08-2020
That’s a good example of what i’m after thank you!
One question I have.
My knowledge is very limited regarding this so, could you provide an example of how i would set the date as the now.ToString(“ddd-MM-yyyy”), create the If statement excluding Sat and Sun. and then convert it to the date format that I want, that is dd/mm/yyyy (09/08/2020 as example)?
Sorry i’m back again, just notice something regarding this and i have another question.
I missed something out from my original post so I do apologizes for that.
i’ll provide some context so you may better understand what i’m trying to achieve.
I need to input a delivery date into a text field for a customer. and each customer has a different lead time (24 hour delivery, 48 hour delivery, 72 hour delivery, 2 weeks, 4 weeks, etc).
so the solution you’ve given me is definitely on the right tracks for what i’m after, but i noticed that for instance, if i put in an order on say like friday the 7th for an example, on a 24 hour delivery(so 1 day).
I need it to go to the next working week day (monday) rather than the saturday it would naturally fall on.
Does this make sense? sorry i wasn’t more clear in my initial post.