09-21-2023 03:22 PM
Hello,
I am trying to automatize REST Get extraction by setting up Query Parameters in the REST Get snap with date 1 and date 2. My idea is to schedule the pipeline every 1st of the month and date 2 should be Today minus one day and date 1 should be today minus one month. So for example if today is 1st of October, then date 2 should be Oct 1st - 1 day = 30 Sept and date 1 should be Oct 1st - 1 month = Sept 1st.
These are the functions I created, but they don't seem to be working (I am not sure how to print the output of the functions). Both need to be in yyyy-MM-dd format.
date 1 = Date.toFormat(new Date().setMonth(new Date().getMonth() - 1), "yyyy-MM-dd")
date 2 = Date.toFormat(Date.now() - (24 * 60 * 60 * 1000), "yyyy-MM-dd")
Any help is appreciated, thanks