# How to use pre-script to add days on current date with HTTP Synthetic?

**URL:** <https://community.dynatrace.com/t/how-to-use-pre-script-to-add-days-on-current-date-with-http-synthetic/48383>\
**Category:** Synthetic Monitoring\
**Tags:** synthetic-monitoring\
**Created:** [October 17, 2024, 10:22am UTC](https://community.dynatrace.com/t/how-to-use-pre-script-to-add-days-on-current-date-with-http-synthetic/48383 "2024-10-17T10:22:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![H\_THIM](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@H\_THIM](https://community.dynatrace.com/u/H_THIM)\
**Post date:** [October 17, 2024, 10:22am UTC](https://community.dynatrace.com/t/how-to-use-pre-script-to-add-days-on-current-date-with-http-synthetic/48383/1 "2024-10-17T10:22:02Z")

</div>

Hello .

can someone help on this item please ?

i want to add few days on the&nbsp;&nbsp;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

---

<div class="post-metadata">

**Author:** ![hannahmac](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@hannahmac](https://community.dynatrace.com/u/hannahmac)\
**Post date:** [October 17, 2024, 10:26am UTC](https://community.dynatrace.com/t/how-to-use-pre-script-to-add-days-on-current-date-with-http-synthetic/48383/2 "2024-10-17T10:26:33Z")

</div>

Have you tried the snippet [here?](https://community.dynatrace.com/topic/209315)&nbsp;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](https://community.dynatrace.com/topic/250426)

---

<div class="post-metadata">

**Author:** ![H\_THIM](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@H\_THIM](https://community.dynatrace.com/u/H_THIM)\
**Post date:** [October 17, 2024, 10:53am UTC](https://community.dynatrace.com/t/how-to-use-pre-script-to-add-days-on-current-date-with-http-synthetic/48383/3 "2024-10-17T10:53:44Z")

</div>

Thanks a lot .

it’s good start it will help for sure
