在JMeter中将当前时间转换为GMT和EPOCH

Convert the current time to GMT and EPOCH in JMeter

在我的脚本中,我想将当前系统时间转换成相应的GMT和EPOCH时间,有什么办法吗?

IST 到 GMT dd/mm/yyyy HH:MM:SS

IST 到 EPOCH

  1. 获取自 Unix epoch - __time() 函数开始以来的当前时间(以毫秒为单位)

    ${__time(,)}
    
  2. 以您当前时区的给定格式获取您的当前时间 - 与 format 提供的相同 __time() 函数:

    ${__time(dd/MM/yyyy hh:mm:ss,)}
    
  3. 无论您当前的时区是什么,都以 IST 时区获取您的当前时间 - __groovy() function

    ${__groovy(new Date().format("dd/MM/yyyy hh:mm:ss"\, TimeZone.getTimeZone('IST')),)}
    
  4. 无论您当前的时区是什么,都以 GMT 时区获取您当前的时间 - 相同的 __groovy() 函数:

    ${__groovy(new Date().format("dd/MM/yyyy hh:mm:ss"\, TimeZone.getTimeZone('GMT')),)}
    

演示:

有关 JMeter 函数概念的更多信息:Apache JMeter Functions - An Introduction