cancel
Showing results for 
Search instead for 
Did you mean: 

Current date in SoapUI NG

SOLVED
Highlighted
Occasional Contributor

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.

2 ACCEPTED SOLUTIONS

Accepted Solutions
New Contributor

Re: Current date in SoapUI NG

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.

View solution in original post

Contributor

Re: Current date in SoapUI NG

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

View solution in original post

3 REPLIES 3
New Contributor

Re: Current date in SoapUI NG

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.

View solution in original post

Occasional Contributor

Re: Current date in SoapUI NG

Gurunath, thank you for you reply!

 

I have one question to you. Where can I insert that code to be able to use variable ExecutionStartDate in my XML script?

 

Contributor

Re: Current date in SoapUI NG

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

View solution in original post

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors