Dateadd function is used to find the future date or old date in QTP.
For example -
Let say you are testing a trading application where you need to calculate the settlement date for a given trade with trade date as say today.
Now the formula for finding the settlement date is -
settlement date = trade date + 3 business days
In such scenarios you will have to add 3 business days to given trade date.
You can make use of dateadd function in QTP.
print dateadd("d",3,now)
Above statement will add 3 days to current date and return the date.
You can also find any previous date using above syntax.
print dateadd("d",-1,now)
This will calculate yesterday's date
print dateadd("d",1,now)
This will calculate tomorrow's date
Syntax of DateAdd function in QTP.
Dateadd(interval_Type, Interval_Units, date)
Interval Type can be of below types.
yyyy - Year
m - Month
d - Day
h - Hour
n - Minute
s - Second
Please find below more questions and answers on date and time in QTP.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
For example -
Let say you are testing a trading application where you need to calculate the settlement date for a given trade with trade date as say today.
Now the formula for finding the settlement date is -
settlement date = trade date + 3 business days
In such scenarios you will have to add 3 business days to given trade date.
You can make use of dateadd function in QTP.
print dateadd("d",3,now)
Above statement will add 3 days to current date and return the date.
You can also find any previous date using above syntax.
print dateadd("d",-1,now)
This will calculate yesterday's date
print dateadd("d",1,now)
This will calculate tomorrow's date
Syntax of DateAdd function in QTP.
Dateadd(interval_Type, Interval_Units, date)
Interval Type can be of below types.
yyyy - Year
m - Month
d - Day
h - Hour
n - Minute
s - Second
Please find below more questions and answers on date and time in QTP.
- How to extract date part from timestamp in QTP?
- How to find the name of month of given date in QTP?
- How to extract time part from given date in QTP?
- How to extract the second part from given time stamp in QTP?
- Explain dateadd function in qtp with Example.
- How to find future date in qtp?
- How to get the system date in qtp?
- How to verify the date format in qtp?
- How to find the yesterday's date in qtp
- How to find the date difference in qtp
- How to get the current system date in qtp?
- How to get the current year in qtp?
- How to find the name of week day for given date in QTP?
- Explain now function in qtp.
- Explain the datediff function in qtp.
Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs