Forum Discussion

cpgutierrezm's avatar
cpgutierrezm
Occasional Contributor
7 years ago

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

  • Nastya_Khovrina's avatar
    Nastya_Khovrina
    SmartBear Alumni (Retired)

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