How to get the dates in between two dates

iam having from date and to date
from_date : 11/02/2018
to_date : 15/02/2018

i want to get the dates in between these two and put it into one string array .

arry_string = { "11/02/2018 , 12/02/2018 , 13/02/2018 / 14/02/2018, 15/02/2018 "}

can any tell me how to solve this problem . this is imp for my project .

2 Likes

Hey @akshaygm12

Check out this workflow i made for you.
Dates.xaml (11.3 KB)

Let me know if it helps :slight_smile:

Cheers!

thanks rishabh .working . :slight_smile:

1 Like

the above work flow will work for short interval only, because you have used logic to substract to_date.Day-from_date.Day

@vvaidya @aksh1yadav I need a list/array of days in between a given time range(from 01-01-2017 to currentDate)
we can doing this easily in java and python and other languages, how can we achieve it in Uipath/vb/c#
it will be Great healp

Hey @aditya.prakash

Check this out. I think this will be the solution for your problem.GenerateDateRange.xaml (10.6 KB)

2 Likes

Can you please tell how to check the dates lie between those dates or no.

When building an events calendar recently I needed to obtain all the dates between two dates. For others looking to do the same thing I used the code below to achieve this. Simply change the $date_from and $date_to variables to get it working for you.

  1. // Specify the start date. This date can be any English textual format
  2. $date_from = “2010-02-03”;
  3. $date_from = strtotime($date_from); // Convert date to a UNIX timestamp
  • // Specify the end date. This date can be any English textual format
  1. $date_to = “2010-09-10”;
  2. $date_to = strtotime($date_to); // Convert date to a UNIX timestamp
  • // Loop from the start date to end date and output all dates inbetween
  1. for ($i=$date_from; $i<=$date_to; $i+=86400) {
  2. echo date(“Y-m-d”, $i).‘
    ’;
  3. }

Great work flow here, thank you for sharing! When i use dates in separate months, for example: 04/29/2019 to 05/03/2019. It will give me an error of ‘arithmetic overflow’.

However, when i try the dates 05/01/2019 & 05/03/2019 it gives me the dates in between. The workflow (as i am using it) will only toggle between 1. Days in the same month.
2. Days with a lower day (Numerical value) than the end date.

Hi, How are you ?
i want to have all the dates between today’s date and today’s-7 how can i do that please

If someone is still in search of a valid solution, kindly review the workflow
ExtractDatesBasedOnDateRange.xaml (16.1 KB)