Showing results for 
Search instead for 
Did you mean: 

Change the / in aqDateTime.Today to -


Re: Change the / in aqDateTime.Today to -

function reformat_date(current_datetime) {
    return aqConvert.DateTimeToFormatStr(current_datetime, "%m-%d-%Y");

function test() {
    return reformat_date(aqDateTime.Today());

ok- this is just a scripting question, which i think would be worthwhile going over. if you run the helper function "reformat_date" it takes in one parameter, which we are calling "current_datetime". This function (reformat_date) wants to take in the input of current_datetime (which we usually get by using the built in object/method of "aqDateTime.Today()" ) and then outputs (or "returns") the same date (which is our current date) in the format that we want with the "-" separators. This is why if you try to simply run the "reformat_date" function, you get an error, since you havent inputted any date in to reformat in the first place. 

Now the second function  above called "test", you can see that I've now added in a second line that reads 

 return reformat_date(aqDateTime.Today());

 such that as a result or running this script routine called "test" we not only log a message that reads the reformatted output of the current date (you can also observe here that the function "reformat_date" is now using the input parameter (of "aqDateTime.Today()" which holds our current date in the original format without the "-"). The second line outputs, as a result of running this "test" function, the current date in that same reformatted version with the "-" separators.

1. drag this "test" function in (as it is currently written, this will always grab the current date, reformat it, and return that reformatted version/ while also logging it as a message). 

2. drag in an on screen action, grab (drag and drop the blue target sign cursor thingy) the on screen element that you would like to type into.. the operation you want to use will most likely be "SetText" or "Keys" (usually the former). 

3. when it asks you what the value of the "SetText" operation should be, you can click the 3 dots, and point it to the "Last Operation Result". In which case this is referring to the result of the script routine "test" that we ran just prior to performing this on screen action. 

4. profit

Justin Kim

View solution in original post

New Here?
Join us and watch the welcome video:
Top Kudoed Authors