Reputation: 914
in VBScript, we can loop between 2 dates, using:
for k = date() to date()+4
...
next
But if I want the loop to be in reverse, neither of the following work:
for k = date()+4 to date()
for k = date() to date()-4 step-1
They just give an empty loop.
Is there a way to do this? I need the dates in descending order.
Upvotes: 1
Views: 3884
Reputation: 16682
Really?, your last example works for me. Would have posted this as a comment but wanted to show the output working, your code seems fine.
Dim k
For k = Date() To Date() - 4 Step - 1
WScript.Echo k
Next
Output:
21/03/2016
20/03/2016
19/03/2016
18/03/2016
17/03/2016
Upvotes: 1