How can human readable date time format(yyyy.mm.dd hh:mm:ss ) be converted into Unix timestamp?
For example I have following date 2019.07.12 08:00:00 that need to be converted into unix time format?
Is there a way to do this in JMeter?
How can human readable date time format(yyyy.mm.dd hh:mm:ss ) be converted into Unix timestamp?
For example I have following date 2019.07.12 08:00:00 that need to be converted into unix time format?
Is there a way to do this in JMeter?
You can use the following __groovy() function:
${__groovy(new SimpleDateFormat('yyyy.MM.dd HH:mm:ss').parse('2019.07.12 08:00:00').getTime(),)}
Demo:
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
Add a Flow Control Action and add in it a JSR223PreProcessor with this code
def date = Date.parse("yyyy.MM.dd HH:mm:ss", yourDate)
vars.put("date", date.getTime().toString())
You can then use:
${date}
If using JMeter 5.3, add groovy-dateutil to lib folder of JMeter, due to this regression :