Iterate through calendar change day and month

Hi All,


I want to select a date and create it where it goes from current date + 1 and then a counter with it to keep adding onto the date. Once it gets to the last date in the month it changes the month. I would like it to do that for a year.
Any ideas in how to go about this.

@Stabbathehut - did you try passing the date in the URL?
If I search for 02/04/2020, this is the URL:
https://www.tui.co.uk/destinations/packages?airports[]=LCY|LGW|LHR|LTN|SEN|STN&units[]=002101%3ADESTINATION&when=04-02-2020&until=&choiceSearch=false&flexibility=true&monthSearch=false&flexibleDays=3&flexibleMonths=&noOfAdults=2&noOfChildren=0&childrenAge=&duration=7115&searchRequestType=ins&searchType=search&sp=true&multiSelect=true&room=&isVilla=false&reqType=&sortBy=

You can do a loop and increment now.ToShortDateString by 1 day and pass in the URL (“when=”).

Hope this helps!

2 Likes

Hi there,

Wow that’s a really interesting way of doing this task. Slightly unconventional from what I was thinking but works nonetheless! Would I have to create a statement for each month saying if the 5/6 character in string where it has the date has 30 days or 31? Let me know if that makes sense

@Stabbathehut, i see the website accepts date as dd-mm-yyyy, try

searchDate = now.AddDays(1).Tostring(“dd-MM-yyyy”)

searchDate should be a datetime variable.

Hope this helps!

Edit: should be

searchDate = searchDate.AddDays(1).Tostring(“dd-MM-yyyy”)

and default searchDate to now.ToShortDateString in the variables panel

so that means it automatically changes month?

@Stabbathehut - Yes, it automatically changes month. (Test it though :slight_smile:)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.