Date Range in Revit Dynamo

How to make a list of Dates from Two dates?
e.g, 02-07-2022 and second date is 02-08-2022
I want a list having the range form these two dates
e.g., it should look like this:
02-07-2022
03-07-2022
04-07-2022
.
.
so on to
01-08-2022
02-08-2022

@jacob.small , @Nick_Boyts @sovitek Please guide.

Use 1…7 instead of 7

3 Likes

Many Thanks :')

Here is an alternative ,

import datetime


dates = []
d = datetime.date(2022, 4, 1)
while d <= datetime.date(2022, 8, 1):
    dates.append(datetime.datetime.strftime(d,'%Y-%m-%d'))
    d += datetime.timedelta(days=1)
    
OUT = dates
3 Likes

Thank you for your response.
Can you please make nodes of python in dynamo with inputs and illustrate this alternate?

Here it is,
No input is required for this code. Just change the numbers in the code.

I got referred from Here.

1 Like

An alternative, by keeping the System.DateTime objects

import sys
import clr
import System

date_A = IN[0]
date_B = IN[1]
dates = [date_A]
elapsed_days = date_B.Subtract(date_A).Days
#
for i in range(elapsed_days):
    add_value = System.Double(i * 1.0 + 1)
    dates.append(date_A.AddDays(add_value))
    
OUT = dates

1 Like