Forum Discussion

Alex_'s avatar
Alex_
New Contributor
9 years ago

Set current date from setup script

Hi!
Please help.
I need send request with date parameter = current date

I create parameter "today" and write setup script: testRunner.testCase.setPropertyValue("today", new Date().format("yyyy-MM-dd'T'hh:mm:ss'Z'"))

But when I check script I get error: org.mozilla.javascript.EcmaError: TypeError: Cannot find function format in object Fri Dec 16 2016 00:06:36 GMT+0400.

Please help me understand what I do wrong. thanks in advance all

  • try to import java package, like import java.util.TimeZone;

    • Alex_'s avatar
      Alex_
      New Contributor

      Thank you!

      And how can I do it?

      • nmrao's avatar
        nmrao
        Champion Level 2
        Not sure of your question. Screen shot shows how to do it using the comment. There are are single quotes around Z in your case. Just use as it being in the screen shot. Have you tried as it appear there?