Problem:
How to generate epoch timestamp in seconds in JMeter script?
Solution:
JMeter function time() generates timestamp in epoch format in millisecond i.e. 13 digits numbers like 1559815879767. Sometimes there is a requirement to pass the current timestamp in second i.e. 10 digits numbers like 1559815879. Some performance testers use BeanShell code to convert epoch timestamp (which is in milliseconds) to second. Just to recall, try to avoid the use of BeanShell or Groovy coding unless you have an alternate way.
There is a simple way to generate the timestamp in second in JMeter script. Instead of writing BeanShell or Groovy code, you can use the below statement where you want to pass the timestamp in second:
${__time(/1000,)}
Refer to the screenshot showing epoch timing in milliseconds and seconds:

How does it work?:
When you use ${__time(/1000,)} then JMeter divides the timestamp (which is in milliseconds) by 1000 and passes in the request (in seconds).
If you want to save the timestamp in a variable then use below statement:
${__time(/1000,testTimeStamp)}
where,
“testTimeStamp” is a variable which stores the value generated by time() function in seconds.
How we can generate 16 digits timestamp i mean microseconds time stamp.
Hi Krishna,
I did not get the solution to this problem. In case you get something, please post to help others.