Highlighted
Valued Contributor.
Valued Contributor.
270 views

Date Format in UFT 15.0

Jump to solution

in UFT 15.0;

I have Date field ( WebEdit) , lets call it "Field AB "and Object Property Value is formatted as 2020-01-31 ( YYYY-MM_DD). I need to change format of "AB" after msgbox AB to read 01/31/2020. 

Can anyone help with this ?

 

Thank you in Advance.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Knowledge Partner
Knowledge Partner

Re: Date Format in UFT 15.0

Jump to solution

Adding the post from James, once you have extracted the date, you can convert it to vartype of date then reorder. something like:

 

myDate = CDate("2020/02/01")
newDate = FormatDateTime(myDate)
MsgBox newDate

 

Mark Smith.

View solution in original post

3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Date Format in UFT 15.0

Jump to solution

hi, there

you may use getROProperty method to get the date out from the field and after that, it's just VBScript to handle the string. 

You can find both references from the online help. 

https://admhelp.microfocus.com/uft/en/15.0/UFT_Help/Content/User_Guide/Retrieve_Set_TOProp.htm?Highlight=getroproperty

https://admhelp.microfocus.com/uft/en/15.0/UFT_Help/Content/Landing_Pages/VBScriptRefLegal4TopNav.htm

Thanks.

James 

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: Date Format in UFT 15.0

Jump to solution

Adding the post from James, once you have extracted the date, you can convert it to vartype of date then reorder. something like:

 

myDate = CDate("2020/02/01")
newDate = FormatDateTime(myDate)
MsgBox newDate

 

Mark Smith.

View solution in original post

Highlighted
Valued Contributor.
Valued Contributor.

Re: Date Format in UFT 15.0

Jump to solution

Thank You. Worked perfectly.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.