I have extracted an element using Expath extractor and it is returning below: Nov. 2015 However I only need the date that is 11/1/2015.

  • can you share the test plan configuration and the result you are getting? Oct 11, 2018 at 4:44

1 Answer 1


Assuming you have this Nov. 2015 stored as a JMeter Variable called oldDate you can do something like:

vars.put('newDate', Date.parse('MMM. yyyy', vars.get('oldDate')).format('MM/d/yyyy'))

If everything goes well you will be able to refer the converted date as ${newDate} where required


JMeter GRoovy convert date

See Creating and Testing Dates in JMeter - Learn How for more tips and tricks with regards to working with dates in JMeter

  • I didn't get succeded. Code: vars.put('newDate', Date.parse('MMM. yyyy', vars.get('${testxp1}')).format('MM/d/yyyy')) and error is 2018-10-12 17:39:51,157 ERROR o.a.j.e.JSR223PostProcessor: Problem in JSR223 script, JSR223 PostProcessor javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException. I appreciate your help
    – Nitish
    Oct 12, 2018 at 12:19
  • 1. Make sure that your ${testxp1} variable exists and has value of Nov. 2015 using Debug Sampler and View Results Tree listener combination. 2. Amend your code to look like: vars.put('newDate', Date.parse('MMM. yyyy', vars.get('testxp1')).format('MM/d/yyyy'))
    – Dmitri T
    Oct 12, 2018 at 12:29
  • Can you please help me in modifying code in a way to get Nov. 2015 to 11/30/2015?
    – Nitish
    Oct 15, 2018 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.