Date range from "" format


I’m trying to get date range array from 2 string variables: dateStart and dateEnd, which are in “” format. I get these variables from two input dialogs. Also, array must be “” format because I need it later to input it into the calendar on webpage.

Thanks for help.


So the array needs to hold every date value between the start and end dates, including the start and end dates?


Main.xaml (8.6 KB)
Try something like this. Lists are better for stuff like this since they can grow dynamically. When working with DateTime objects you don’t store the format in the variable itself, instead you select the format when you output it.

1 Like

welcome to uipath community
hope these steps would help you resolve this
–create a array variable of type string and define it with default value like
new string(2){} in the variable panel and name it arr_date
–now use input dialog box and get the first start date and store it to a string variable named str_startdate
–use a add to collection activity and in the property panel, mention the collection as arr_date and items as str_startdate and change the type argument as string
–again use another input dialog box and get the enddate to a variable of type string named str_enddate
–use another add to collection activity and in the property panle mentin the collection as arr_date and items as str_enddate and change the type argument as string

then we can use this arr_date array of string where we want by mentioning its index position to access the value

Cheers @Bojan_Tomsic

1 Like

This can be quickly achieved with linq. You need to first convert dateStart and dateEnd from string to a datetime variable. Then you use linq to get the range of dates between dateStart and dateEnd. Then you convert the datetime back to string when actually using it by appending .ToString(“dd.MM.yyyy”) wherever you need the string. I attached a quick example showing how to do this:
AllDatesInRange.xaml (9.6 KB)

1 Like

@DanielMitchell it works :slight_smile: Thanks.

@Dave your solution gives output such as: 01.01.0001, 02.01.0001, 03.01.0001 and continues until you cancel it. Thanks anyway :slight_smile:

1 Like

@Bojan_Tomsic sounds like your start date was not initialized as I tested it without issue. No worries, glad you got a solution you’re happy with :slight_smile:

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