Dim a
a=WeekDayName(1)
Msgbox a
Output-Sunday
Dim a
a=WeekDayName(5)
Msgbox a
Output-Thursday
qtp script to return specific weekday name-VBScript Weekdayname function-script in qtp to display specific weekday name-QTP Scripts-VBScript examples
Qtp script to return year from specified date-vbscript year function-script in qtp to display year from specified date-scripts in qtp-vbscript
Returns a whole number representing the year
Dim a
a=Year(Now)
Msgbox a
Output-2011
Dim a
a=Year("June 16, 2020")
Msgbox a
Output-2020
QTP Script to return day of the week-weekday vbscript function-vbscript weekday function with example-vbscript functions-scripts in qtp
Returns a whole number from 1 to 7
Dim a
a=Weekday(Now)
Msgbox a
Output-4
Dim a
a=Weekday("June 5, 2011")
Msgbox a
Output-1
qtp script to return second of the minute-vbscript second function-scripts in qtp-VBSCRIPT Functions with examples and outputs
Returns a whole number from 0 to 59
Dim a
a=Second(Now)
Msgbox a
Output-25
qtp script to return month of the year-vbscript Month function-script in qtp to display month of the year-qtp scripts-scripts in qtp-vbscript and qtp
Returns a whole number from 1 to 12
Dim a
a=Month(Now)
Msgbox a
Output-6
QTP script to return minute of the hour-script in qtp to print minute of the hour-vbscript function examples-Minute function example(VBScript)
Returns a whole number from 0 to 59
Dim a
a=Minute(Now)
Msgbox a
Output-5
qtp script to return hour of the day-vbscript Hour Function example-vbscript functions with examples-scripts in qtp with code-qtp examples-qtp scripts
Returns a whole number from 0 to 23
Dim a
a=Hour(Now)
Msgbox a
Output-17
QTP script to return day of the month-Day function example-vbscript Day function-qtp scripts with examples and outputs-QTP
Returns a whole number from 1 to 31
Dim a
a=Day(Date)
Msgbox a
Output-15
Dim a
a=Day("June 16, 2011")
Msgbox a
Output-16
QTP Script to Replace a word in a string with another word-Replace VBScript Function example-scripts in qtp-Replace function example-vbscript function
Dim b
b=Replace("QTP","P","T")
msgbox b
Output-QTT
Dim a,b
a="Software Testing"
b=Replace("Software Testing","Software","Manual")
msgbox b
Output-Manual Testing
qtp script to return character corresponding to the given ASCII value-script in qtp to return the character associated with the specified ANSI code
Dim a
a=Chr(65)
msgbox a
Output-A
Dim a
a=Chr(97)
msgbox a
Output-a
QTP Script to return ASCII value of a given character-script in qtp to return the ANSI character code corresponding to given character-Asc function
Dim a
a=Asc("A")
msgbox a
Output-65
Dim a
a=Asc("a")
msgbox a
Output-97
qtp script to return specified number of characters from a string-VBScript Mid Function example-vbscript function commands-scripts in QTP-QTP Scripts
Dim a
a=Mid("qtp",2)
msgbox a
Output-tp
Dim a
a=Mid("Testing",1,4)
msgbox a
Output-Test
Dim a
a=Mid("Software Testing",10,7)
msgbox a
Output-Testing
QTP Script to convert a string into uppercase-vbscript UCase function-vbscript functions with examples-script in qtp to display string in upper case
Dim a
a=UCase("qtp")
msgbox a
Output-QTP
Dim a
a=UCase("software testing")
msgbox a
Output-SOFTWARE TESTING
QTP Script to convert a string into lowercase-VBScript Functions-VBScript LCase Function-VBScript Commands-LCase vbscript function example-qtp scripts
Dim a
a=LCase("QTP")
msgbox a
Output-qtp
Dim a
a=LCase("SOFTWARE TESTING")
msgbox a
Output-software testing
qtp script to insert spaces between two strings-QTP Scripts Blog-Space function example-vbscript functions with examples-qtp code examples
Dim a
a = "Fun and" & Space(10) & "Knowledge"
MsgBox a
qtp script to return the current system time-Program to display system time in qtp-script in qtp to print system time-Time function example in QTP
Dim a
a = Time
msgbox a
Output-12:12:12
QTP script to return the number of characters in a string-len function example-qtp script to display the number of characters in a string
Dim a
a=len("qtp")
msgbox " Length of String a is = " & a
Output-Length of String a is = 3
Dim a
a=len("Testing")
msgbox " Length of String a is = " & a
Output-Length of String a is = 7
Qtp script to return specific Month Name-MonthName Function example-qtp script to display specific Month Name-qtpscripts-basic scripts in qtp
Dim a
a = MonthName(5)
msgbox a
Output=May
Dim a
a = MonthName(12)
msgbox a
Output=December
qtp script to return square root of a number-basic qtp scripts-qtp scripts-Sqr function example-qtp scripts with outputs
Dim a
a = Sqr(16)
msgbox a
output=4
Dim a
a = Sqr(20)
msgbox a
output=4.47213
qtp script to return a string in reverse order-script in qtp to print string in reverse order-StrReverse String Function example-qtp basic scripts-qtp
Dim a
a = StrReverse("QTP")
msgbox a
Output-PTQ
Dim a
a = StrReverse("Software Testing")
msgbox a
Output-gnitseT erawtfoS
qtp script to print odd numbers-script in qtp to print odd numbers from 1 to 10-basic qtp scripts for beginners-qtp sample examples-qtp scripts-qtp
dim i
for i=1 to 10
if (i mod 2<>0) then
msgbox i&"is odd number"
end if
next
above example prints odd numbers from 1 to 10.
QTP Script to print even numbers-Program to print even numbers in quick test professional(QTP)-qtp basic scripts-qtp examples-qtp sample programs-qtp
dim i
for i=1 to 10
if (i mod 2=0) then
msgbox i&"is even number"
end if
next
above example prints even numbers from 1 to 10.