Jmeter-获取当前日期和时间 [英] Jmeter - get current date and time

查看:1048
本文介绍了Jmeter-获取当前日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取当前日期和时间作为示例日期:2014年11月10日,上午8:30或下午6:00,并将其作为参数传递给我的Jmeter测试.可以帮我做到这一点.

I want to get the current date and time as example date: 11/10/2014 and time 8:30 am or 6:00 pm and pass it as parameters to my Jmeter test. Can some help me do this.

推荐答案

使用 __time 函数:

  • $ {__ time(dd/MM/yyyy,)}

  • ${__time(dd/MM/yyyy,)}

$ {__ time(hh:mm a,)}

${__time(hh:mm a,)}

自JMeter 3.3起,有两个新函数可让您计算时间:

Since JMeter 3.3, there are two new functions that let you compute a time:

__timeShift

  "The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added" and 

__RandomDate

  "The RandomDate function returns a random date that lies between the given start date and end date values." 

自JMeter 4.0起:

Since JMeter 4.0:

dateTimeConvert

Convert a date or time from source to target format

如果您想正确学习jmeter,请阅读这本将为您提供帮助.

If you're looking to learn jmeter correctly, this book will help you.

这篇关于Jmeter-获取当前日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆