There are many scenarios where you will need to find the current year in QTP.
Example -
Consider a scenario where you have to verify that the year displayed on the web page is correct or not.
Please note that You have to just verify the year in yyyy in this format and not the entire date.
QTP (Vb script) provides below function to find the current year.
print year(now)
Above statement will print the current year.
The only parameter year function takes is the valid date. So if you want to find the year part of any given date in QTP you can pass the date as a first parameter.
Example -
print year("3-jun-2011")
Above statement will print 2011.
Real Life usage of Year function in QTP. (Practical Project application of Year function)
We can use year function to find the current date which can be used to create unique random numbers. Random numbers or strings can be used in many situations like creating automation reports with unique file names.
This is how you can get the year of any given date in vbscript and QTP.
Please find below more questions and answers on date and time in QTP.
Please give your inputs, suggestions, feedback to Us. We value your thoughts.
Example -
Consider a scenario where you have to verify that the year displayed on the web page is correct or not.
Please note that You have to just verify the year in yyyy in this format and not the entire date.
QTP (Vb script) provides below function to find the current year.
print year(now)
Above statement will print the current year.
The only parameter year function takes is the valid date. So if you want to find the year part of any given date in QTP you can pass the date as a first parameter.
Example -
print year("3-jun-2011")
Above statement will print 2011.
Real Life usage of Year function in QTP. (Practical Project application of Year function)
We can use year function to find the current date which can be used to create unique random numbers. Random numbers or strings can be used in many situations like creating automation reports with unique file names.
This is how you can get the year of any given date in vbscript and QTP.
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. We value your thoughts.
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs