Find all the date from the From_Date to To_Date

Hi team,
Facing a difficulty in finding all the dates from a given From_Date to a given To_Date.
Input will be like:
image
Output will be
image
Want the output dates in a variable using assign variable.
Thanks in Advance.

Hi @yash.choursia
Check out this workflow i made for you.
Dates.xaml (11.3 KB)

Let me know if it helps :slight_smile:

Happy Automation …!!!

1 Like

HI,

Can you try the following?

strFromDate = "18-12-2022"
strToDate = "25-12-2022"

dFrom = DateTime.ParseExact(strFromDate,"d-M-yyyy",System.Globalization.CultureInfo.InvariantCulture)
dTo =DateTime.ParseExact(strToDate,"d-M-yyyy",System.Globalization.CultureInfo.InvariantCulture)

Then

arrDate = Enumerable.Range(0,(dTo-dFrom).Days+1).Select(Function(i) dFrom.AddDays(i)).ToArray()

note: arrDate is DateTime array type

If you need to write it to wroksheet the following will work.

dt = arrDate.Select(Function(d) dt.LoadDataRow({d.ToString("dd-MM-yyyy")},False)).CopyToDataTable()

Sample20230202-3L.zip (2.9 KB)

Regards,