I am using JMeter for regression testing, and needed a way to use the current date in mm/dd/yyyy format in a form post. Here is the solution I came up with using the JavaScript function:
${__javaScript(d = new Date; prefix=d.getMonth()<9?'0':'';X = prefix + String(d.getMonth()+1) + '/' + d.getDate() + '/' + d.getFullYear(), Dummy)}
Looks like date formatting in JavaScript is a perpetual problem, so I hope this is helpful.
1 comment:
thanks for your jmeter tip. It helped me heaps
Post a Comment