在JMeter中以24小时格式获取当前时间

问题描述:

如何在JMeter中以24小时格式获取当前时间.

How can I get current time in 24 hours format in JMeter.

我尝试了${__time(hh:mm a,)},但结果为AM/PM格式.

I tried ${__time(hh:mm a,)} but it results in AM/PM format.

按照 __time()函数输出可以通过 SimpleDateFormat 进行控制类模式.

As per How to Use JMeter Functions guide JMeter's __time() function output can be controlled via SimpleDateFormat class patterns.

查看JavaDoc:

  • 您不需要a字母
  • 您需要在0-24小时内使用大写字母H或在1-23小时内使用小写字母k
  • you don't need a letter
  • you need to use capital H for 0-24 hours or lowercase k for 1-23 hours

因此将功能更改为${__time(HH:mm,)}就应该了

So change function to ${__time(HH:mm,)} and that should be it