0

I am currently using '${__time()}' function which returns the current time in milliseconds. However, I want something like this - Date Input 'mm/dd/yyyy' and Function Output '1504290600'. can somebody please help me. Note: I want output as Linux time and not in other formats as other questions already have.

Jay Mehta
  • 77
  • 1
  • 5

1 Answers1

1

Out of box JMeter doesn't provide this functionality, you will need a custom script for this, I would recommend using JSR223 Test Elements or Groovy function for this

Example code would be something like:

${__groovy(new Date().parse("MM/dd/yyyy"\, "09/04/2017").getTime(),)}

Or in case of non-functions:

def timestamp = new Date().parse("MM/dd/yyyy", "09/04/2017").getTime()
log.info('Required time is: ' + timestamp)

JMeter Groovy Convert Time

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