cancel
Showing results for 
Search instead for 
Did you mean: 

How to do to get date from the system

Occasional Contributor

How to do to get date from the system

Hi, please I need to get the date (TODAY) from the system... Do you know please which is the correct algorithm to apply ?

 

Thank you so much !!

 

Regards.

2 REPLIES 2
Moderator

Re: How to do to get date from the system

Hi Cecilia,

 

The following script should work if you put it in the Groovy Test Step: 

 

import java.text.SimpleDateFormat
def date = new Date()
sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss")
log.info(date)


 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
Community Hero

Re: How to do to get date from the system

You need to post the question with details and do not let users image your issue.

Where do you need to use it? In a soap request? rest ? groovy script?
What date format do you need?


Regards,
Rao.