Hi,
You can try with the below ways:
Way1: Use FormatDateTime built-in function ( Refer the QTP help file for more info.)
Way2: Refer the below code
You can try with the below ways:
Way1: Use FormatDateTime built-in function ( Refer the QTP help file for more info.)
Way2: Refer the below code
Code:
x="May 31 2011"
Dpart=DatePart("d",x)
Mpart=DatePart("m",x)
Ypart=DatePart("yyyy",x)
If Dpart<=9 then
Dpart="0"&Dpart
End if
If Mpart<=9 then
Mpart="0"&Mpart
End if
RequiredDateVal=Ypart&"-"&Mpart&"-"&Dpart
Msgbox RequiredDateVal
