You can find the name of the month like January, February etc from a given date using below code.
There are 2 functions which help you find the name of month.
1. month(anyvalid_date) - returns the numeric representation of month .
2. monthname(intX) - returns human readable month name like January, February etc
print monthname(month(now))
Above statement will print the current month name of the system.
print monthname(month("09-jan-1986"))
'Will print january
To get the month name in abbreviated form use below statement
print monthname(month("09-jan-1986"), true)
'Will print Jan.
Thus when you pass the second parameter as true, you will get the month name in 3 letter format like Jan, Feb etc.
Above statement will print the name of the month for the date 09-jan-1986.
Numeric representation of month is given below
1 - January(default)
2 - February
....and so on......
This is how you can find the name of the month for given date in QTP and vbscript.
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.
There are 2 functions which help you find the name of month.
1. month(anyvalid_date) - returns the numeric representation of month .
2. monthname(intX) - returns human readable month name like January, February etc
print monthname(month(now))
Above statement will print the current month name of the system.
print monthname(month("09-jan-1986"))
'Will print january
To get the month name in abbreviated form use below statement
print monthname(month("09-jan-1986"), true)
'Will print Jan.
Thus when you pass the second parameter as true, you will get the month name in 3 letter format like Jan, Feb etc.
Above statement will print the name of the month for the date 09-jan-1986.
Numeric representation of month is given below
1 - January(default)
2 - February
....and so on......
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