Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to input a dynamic date in the date field
#1
Solved: 11 Years, 4 Months ago
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.
Reply
#2
Solved: 11 Years, 4 Months ago
when you use a variable, you should not use the double quotes (") with Set statement.
remove double quotes it should work.

Reply
#3
Solved: 11 Years, 4 Months ago
I was getting the error message "The parameter is not correct" when I removed the quotes after the Set statement.
Reply
#4
Solved: 11 Years, 4 Months ago
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
Reply
#5
Solved: 11 Years, 4 Months ago
This worked great !!! Thanks for your help..
Reply
#6
Solved: 11 Years, 4 Months ago
replace(dateAdd("yyyy",1,date),"/",".") use this command straight away without any variable - try it Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to input Japanese Character through UFT Alaguraja 0 900 07-01-2020, 11:32 AM
Last Post: Alaguraja
  getting the value from the field learning 0 1,038 03-19-2019, 09:13 AM
Last Post: learning
  How to append date to xls file using qtp datatable methods? yona34 1 1,644 05-04-2018, 08:56 PM
Last Post: Ankur
  QTP not recognizing date calendar kQTPs 1 3,608 12-20-2017, 11:21 PM
Last Post: harikrishna
  How to get input from the user in QTP? shanthiK 10 18,561 08-07-2017, 11:34 PM
Last Post: zunebuggy

Forum Jump:


Users browsing this thread: 1 Guest(s)