Forum Discussion

leeasdf9's avatar
leeasdf9
Frequent Contributor
13 years ago

how to get the local system date/time

How can i get the local system date and time, and perform some action after the predefined time is reached? can somebody pls.give me a sample to do this task? thx.

2 Replies

  • Anonymous's avatar
    Anonymous

    Hi Lee,





    You can use the aqDateTime object to work with the date and time values. Please refer to the aqDateTime Object Methods article to see all available methods.





    How can i get the local system date and time...


    I recommend that you use the aqDateTime.Now method.





    ...and perform some action after the predefined time is reached?


    You can act in the following way to accomplish your task:





    1. Get the current time value by using the aqDateTime.Time method.





    2. Set the target time value by using the aqDateTime.SetTimeElements method.





    3. Compare these two time values via the aqDateTime.Compare method.





    Please see the sample script below:



      //Compares the current time value and the target one (e.g. 10:00:00)

      while (aqDateTime.Compare(aqDateTime.Time(), aqDateTime.SetTimeElements(10, 00, 00)) == -1) {

      }

      //When the target time value is reached, you can continue the test execution

      Log.Message("The predefined time is reached");







    Also, please refer to the "Working With Time" article - it may contain the information you need.
  • leeasdf9's avatar
    leeasdf9
    Frequent Contributor
    Hi Tanya,

    That is exactly what i want, thx for the support:)



    lee