Forum Discussion

Alex_'s avatar
New Contributor
8 years ago

Set current date from setup script

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

6 Replies

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

    • Alex_'s avatar
      New Contributor

      Thank you!

      And how can I do it?

      • nmrao's avatar
        Champion Level 3
        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?