Micro Focus QTP (UFT) Forums
How to input a dynamic date in the date field - 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: How to input a dynamic date in the date field (/Thread-How-to-input-a-dynamic-date-in-the-date-field)



How to input a dynamic date in the date field - aaa - 02-12-2010

I am trying to enter a date in the date field as '1 year + current date' . When I tried to use the below code, it is entering the in the date field as "Mydate" instead of the 'Current date+1 year. Can anyone please help me in resolving this issue. Thanks in advance for your help.

Code:
Mydate=(DateAdd("YYYY",1,Now))

Code:
Browser("Browser").Page("Page").WebEdit("SearchWidget_1_1{actionFo_2").Set "Mydate"

The current format in the date field is mm/dd/yyyy. I would like to change the format as mm.dd.yyyy after adding 1 year too.


RE: How to input a dynamic date in the date field - Saket - 02-12-2010

when you use a variable, you should not use the double quotes (") with Set statement.
remove double quotes it should work.


RE: How to input a dynamic date in the date field - aaa - 02-12-2010

I was getting the error message "The parameter is not correct" when I removed the quotes after the Set statement.


RE: How to input a dynamic date in the date field - sreekanth chilam - 02-12-2010

Hi ,

Use Date instead of Now

Try with the below code.
Code:
temp=(DateAdd("YYYY",1,Date))
Mydate=replace(temp,"/",".")
Browser("Browser").Page("Page").WebEdit("SearchWidget_1_1{actionFo_2").Set Mydate



RE: How to input a dynamic date in the date field - aaa - 02-12-2010

This worked great !!! Thanks for your help..


RE: How to input a dynamic date in the date field - tester_rahul - 02-17-2010

replace(dateAdd("yyyy",1,date),"/",".") use this command straight away without any variable - try it Smile