Jmeter - get current date and time

前端 未结 6 1837
情歌与酒
情歌与酒 2020-12-14 07:00

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.

6条回答
  •  無奈伤痛
    2020-12-14 07:12

    Use __time function:

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

    • ${__time(hh:mm a,)}

    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." 
    

    Since JMeter 4.0:

    dateTimeConvert

    Convert a date or time from source to target format
    

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

提交回复
热议问题