Forum Discussion

cpgutierrezm's avatar
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 !!



2 Replies

  • Nastya_Khovrina's avatar
    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")
  • nmrao's avatar
    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?