I want loop date from today -count day format (“yyyy/MM/dd”)
variable count = int
Example count = 4
Today = 2021/05/18
I want datetime show 2021/05/13
Now I use DateTime.Today.AddDays(-count).ToString(“yyyy/MM/dd”) but show error.
Please guide me for solve it.
Please mark your answer if solved.
To add or remove days from your declared date, you need to keep all of the variables as type datetime. Later on you can convert it in ToString and use it elsewhere.
Check like this, then you will be able to loop based on the date range.
@sarathi125 If I want use 5 but I want to use variable count.
Please guide me about it.
I am able to use this expression
and got the result as expected
Do u want to use variable count inside the loop
Change the -5 with your Variable as below