cancel
Showing results for 
Search instead for 
Did you mean: 

Setting a variable as today's date

SOLVED
Highlighted
Occasional Contributor

Setting a variable as today's date

Anyone able to help me please,

 

I have  avairable which needs to hold todays date plus a keystroke.

 

the date needs to be in the format dd/mm.

 

currently I manually change the variable whenever I am running my regression testing, for example today it is set to 02/10[Tab] which works perfetly for all my regression tests apart from the fact that I keep forgetting to change it until I am half way through my regression and error messages appear so I have to stop and start again after updating the date.

 

Anyone know a way where I can update the variable automatically with todays date? but without losing the [Tab] at the end

 

Thanks in advance 🙂 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Setting a variable as today's date

aqConvert.DateTimeToFormatStr is your key.

 

code is JavaScript but, hopefully, you get the idea.

 

var dateToday = aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m//%d")

onscreenObject.Keys(dateToday + '[Tab]')

 

 

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/datetimetoformat...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

2 REPLIES 2
Highlighted
Community Hero

Re: Setting a variable as today's date

aqConvert.DateTimeToFormatStr is your key.

 

code is JavaScript but, hopefully, you get the idea.

 

var dateToday = aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m//%d")

onscreenObject.Keys(dateToday + '[Tab]')

 

 

 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/datetimetoformat...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Highlighted
Occasional Contributor

Re: Setting a variable as today's date

Thanks @tristaanogre 

 

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!