0

I have script where current date and current date + 4 days need to be pass as URL param in https req. I want to avoid groovy script or other script here to generate the next date.

To get current system date in epoch format I am using ${__time(/1000,)}

But not sure how to get the next date in this epoch format 1588926501 with using _time or _timeshift option.

Could anyone please help?

Finch
  • 71
  • 1
  • 9

2 Answers2

1

Go for __groovy() function, the relevant syntax would be something like:

${__groovy((new Date().plus(4).getTime() / 1000).longValue(),)}

Demo:

enter image description here

More information:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

Try using : ${__javaScript(Math.round(${__timeShift(,,P4D,,)}/1000),)}

You can also try options from JavaScript function on this POST

Raj
  • 187
  • 1
  • 7
  • @https://stackoverflow.com/users/6619203/raj Thanks for help. But this is giving me time like '1.589524255E9' and expected format is '1589178654'. Could you plz help? – Finch May 11 '20 at 06:32
  • You probably need to do this in two steps: 1. ${__timeShift(,,P4D,,epochTimeInMS)} and then 2. ${__javaScript('${epochTimeInMS}'.slice(0\,10))} – Raj May 11 '20 at 15:50