cancel
Showing results for 
Search instead for 
Did you mean: 

How to get last 30 dates

Rahul
New Contributor III

I have to pass the last 30 dates pipeline for execution. so how i can get the last 30 dates

2 REPLIES 2

j_angelevski
Contributor III

Hi @Rahul,

You can do this with a Mapper with the following expression:

sl.range(0, 31).map(val => {"date": Date.now().minusDays(val)})

This will create an array of the last 30 days. After this, you can use a JSON Splitter to split the array and get each date as an object.
image
image

Result
image

Rahul
New Contributor III

Thanks It’s working expected