I have seen some discussions that are close to my question, but none seem to answer my need. I hope someone here can.
I am pulling a date value (a date of last SW update) from the database. It's in the form 10/29/04. I am using a database output value function. I then put this value into my data table under the parameter Update_Date.
I need to compare this date to verify that it matches the "version date" in my Help > About menu. I use the Text Area Checkpoint function to get this, since it is in a GUI window.
However, the date on the About menu is in the form 29-October-2004.
Is there a way to convert the database (or About menu) value in order to compare them during testing? I can fiddle around with the data table outside of testing , but when executing the test, I cannot determine a way to get both dates in the same format in order to make sure the two match.
Obviously, the long term fix may be to change the date format on the About menu to match the database value, but that's not an immediately available fix.
One easy way is with the FormatDateTime function in QTP. You could set your system date to a specific format that matches either of the dates you are trying to compare then use this function to format the other variable to the same format. Of course, this makes the script subject to failures if you try to run it on another machine without also formatting the system date on that machine first.
A better way is to format it with the Day, Month, Year functions. Also WeekdayName and MonthName.