Utilities.StrToTime Method

Applies to TestComplete 15.10, last modified on December 01, 2021
This method is obsolete. See the Remarks section below.


The Utilities.StrToDate method converts the string specified by the Str parameter to a Variant value that encodes time.



Str [in]    Required    String    
Result Variant

Applies To

The method is applied to the following object:


The method has the following parameter:


Specifies the string to be converted to a Variant value storing time. The Str parameter must consist of two or three numbers separated by the character defined by the TimeSeparator property, optionally followed by an AM or PM indicator. The numbers represent the hour, minute, and (optionally) second correspondingly. If the time is followed by AM or PM, it is assumed to be in 12-hour clock format. If no AM or PM indicator is included, the time is assumed to be in 24-hour clock format.

If Str does not contain a valid time, StrToTime raises an exception.

Result Value

The StrToTime method's return value is a number between 0 and 1 (inclusive) that indicates the fractional part of a day given by the specified time or (if 1.0) midnight on the following day. The value 0 corresponds to midnight, 0.5 corresponds to noon, 0.75 corresponds to 6:00 pm, and so on.


This method is obsolete. It is supported for backward compatibility only. To convert a string to a time value, use the aqConvert.StrToTime method.

See Also

Working With Time
StrToTime Method
DateTimeToStr Method
StrToDate Method
Format Method

Highlight search results