jmeter函數之時間函數__time

新浪圍脖>@o蝸牛快跑o   企鵝交流羣>79642549


常用於帶時間戳的地方

比如:帶時間戳的結果文件,每次運行生成獨立文件

${__time(,)}         1450056496991 //無格式化參數,返回當前毫秒時間
${__time(yyyyMMdd,)} 20151214      //返回年月日
${__time(HHmmss,)}   092816        //返回時分秒
${__time(yyyyMMdd-HHmmss,)} 20151214-092816 //全

官網原文:

19.5.17 __time

The time function returns the current time in various formats.

Parameters

Attribute Description Required
Format The 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 variable The 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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章