Forum Discussion

Svetlana's avatar
Svetlana
Occasional Contributor
9 years ago
Solved

Current date in SoapUI NG

Hello,   I need to insert the current date into XML file. Is there an opportunity to generate the current date? Data Generator doesn't allow that.
  • gurunath's avatar
    9 years ago

    try using following code.

    TimeZone.setDefault(TimeZone.getTimeZone('EST'))
    def now = new Date();
    def ExecutionStartDate = now.format("yyyy-MM-dd hh:mm:ss.SSS")

     

    Note that you can change the timezone and date format as you need.

  • JustinM89's avatar
    JustinM89
    9 years ago

    You can do it in a Groovy script then set the date to a custom property. You should then easily be able to insert into your XML