51Testing软件测试论坛

标题: 【转载】jmeter函数之时间函数__time [打印本页]

作者: lsekfe    时间: 2016-1-6 10:27
标题: 【转载】jmeter函数之时间函数__time
常用于带时间戳的地方

比如:带时间戳的结果文件,每次运行生成独立文件


[plain]
view plaincopy




官网原文:

[url=]19.5.17 __time[/url]
The time function returns the current time in various formats.
Parameters
AttributeDescriptionRequired
FormatThe format to be passed to SimpleDateFormat. The function supports various shorthand aliases, see below. If ommitted, the function returns the current time in milliseconds since the epoch.No
Name of variableThe name of the variable to set.No
If the format string is omitted, then the function returns the current time in milliseconds since the epoch. In versions of JMeter after 2.7, if the format matches "/ddd" (where ddd are decimal digits), then the function returns the current time in milliseconds divided by the value of ddd. For example, "/1000" returns the current time in seconds since the epoch. Otherwise, the current time is passed to SimpleDateFormat. The following shorthand aliases are provided:
  • YMD = yyyyMMdd
  • HMS = HHmmss
  • YMDHMS = yyyyMMdd-HHmmss
  • USER1 = whatever is in the Jmeter property time.USER1
  • USER2 = whatever is in the Jmeter property time.USER2

The defaults can be changed by setting the appropriate JMeter property, e.g. time.YMD=yyMMdd


作者: 清晨一缕阳光    时间: 2016-1-11 17:21
好东西,谢谢分享!
作者: 1014552551    时间: 2016-4-8 16:28
请问是不是不支持yyyyMMddHHmmss 或者YYYYMMDDHH24MISS 这两种格式的时间戳啊?用这两种总是报错,
作者: 1014552551    时间: 2016-4-8 16:33
${__time(yyyyMMddHHmmss,ReqTime)} 格式换成yyyyMMddHHmmss又可以了,是不是对格式大小写敏感呢




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2