13

How do I generate a timestamp and put it in a variable in jmeter? So that the variable can be passed in the URL.

Usama Kareem
  • 53
  • 1
  • 9
Nikhil
  • 393
  • 1
  • 6
  • 25

1 Answers1

28

Add the following function wheerever you want to send the Unix based timestamp:

${__time(,curTime)}

you can refer the value using ${curTime} in later requests.

Example:

HTTP Sampler

enter image description here

in View Results Tree

enter image description here


You can use Function Helper Dialog (in Options), to generate the code:

enter image description here

Note: you can also save the value using name of the variable (second row), so later you can refer the same value.

Note: you can also format the time, based on your needs (first row).

Reference:

http://jmeter.apache.org/usermanual/functions.html#__time

Naveen Kumar R B
  • 6,248
  • 5
  • 32
  • 65