Changing date format in UFT

Question ID: 110061

I have Date field that is a WebEdit object Object Property Value is formatted as 2021-01-29 (YYYY-MM_DD). How would I change format to 01/31/2020?

Marked as spam
Posted by (Questions: 361, Answers: 39)
Asked on January 29, 2021 5:56 pm
Answers (1)
Private answer

You could use the .GetROProperty method on the WebEdit to get the current value and then use VBScript code to change the format. For example:

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

Here's info on GetROProperty.

Here's info on VBScript Date formatting.

Marked as spam
Posted by (Questions: 16, Answers: 772)
Answered on January 29, 2021 6:00 pm
That worked really well, thanks for the example
( at January 29, 2021 6:01 pm)