Micro Focus QTP (UFT) Forums
QTP11.0 - Date format is changed as text while executing the QTP script. - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP11.0 - Date format is changed as text while executing the QTP script. (/Thread-QTP11-0-Date-format-is-changed-as-text-while-executing-the-QTP-script)



QTP11.0 - Date format is changed as text while executing the QTP script. - Automation Tester - 05-28-2014

Hi,

I am using QTP11.0.
I am using extenal file[excel] for testdata.
In one of my scripts, in excel, for one cell i used the formula for date.
the date format is "=Now()+"2:30"

This formula first i tried in testdata file. few days it works fine.after that i did not work well. then I gave the same date fromula in test script file[excel] it self.

when we open the file and see it shows as date .But In both cases it is changed as text while executing the QTP scripts. the cell data shows as "Hide 158".

I tried in different ways. but no luck.

If any body knows the solution please post the answer.

Thanks in Advance...


RE: QTP11.0 - Date format is changed as text while executing the QTP script. - Tarik Sheth - 05-30-2014

Hi Automation Tester,

1. you should format and set the entire column for the time as a particular format like HH:MM or HH:MM:SS like that.
2. Always have the same format as of your system date and time format, you can change it from the Control panel and regional settings.

That being said, you can also add the time in the following way.
DateAdd(interval,number,date)
yyyy - Year
q - Quarter
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week of year
h - Hour
n - Minute
s - Second

adding the time in the above manner will get you rid of the issues.