Forum Discussion

arvindnsn's avatar
arvindnsn
Contributor
7 years ago
Solved

Dynamic Looping to produce date based on input

Hello,

I have a requirement where my pipeline will take 2 input parameters (date type), Start_date and End_date. Based on the input date, i want to generate a list of dates as mentioned below.

For Eg : Start_date = 2019-04-01, End_date = 2019-04-05, I would want downstream output as list of documents or Array( which can be flattened using splitter) as

Start_date = 2019-04-01T00:00:00, End_date = 2019-04-01T23:59:59
Start_date = 2019-04-02T00:00:00, End_date = 2019-04-02T23:59:59
Start_date = 2019-04-03T00:00:00, End_date = 2019-04-03T23:59:59
Start_date = 2019-04-04T00:00:00, End_date = 2019-04-04T23:59:59
Start_date = 2019-04-05T00:00:00, End_date = 2019-04-05T23:59:59

If the both the parameters are null then i would want the below dates as output assuming 2019-04-17T15:50:54 is the current datetime in UTC. Basically the requirement is to take the range of last 4 days from the current date.

Start_date = 2019-04-16T15:50:55, End_date = 2019-04-17T15:50:54
Start_date = 2019-04-15T15:50:55, End_date = 2019-04-16T15:50:54
Start_date = 2019-04-14T15:50:55, End_date = 2019-04-15T15:50:54
Start_date = 2019-04-13T15:50:55, End_date = 2019-04-14T15:50:54

Thanks in advance and really appreciate any help offered.

Thanks
Aravind N

2 Replies