cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use pre-script to add days on current date with http synthetic

H_THIM
Visitor

Hello .

can someone help on this item please ?

i want to add few days on the  api.date() value to have a future date.

but i seems more complicate that i thought

is that possible ? 

i tried many things but still not working .this is my last code i tried :

 

var numberOfDaysToAdd = 10;

api.setValue("DateNow",api.dateToFormat(api.date(), "yyyy-MM-dd"));

var CurrentDate = new date();

DepartureDate = CurrentDate.setDate(api.getValue(DateNow) + numberOfDaysToAdd);

 

thanks for your help and feedback

 

2 REPLIES 2

HannahM
Dynatrace Leader
Dynatrace Leader

Have you tried the snippet here? You could modify it to be suitable for an HTTP Monitor.
There's some great how to guides for Synthetic in the Synthetic Troubleshooting Map

Synthetic SME and community advocate.

Thanks a lot .

it's good start it will help for sure

Featured Posts