Utilities.StrToDateTime Method

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


The Utilities.StrToDateTime method converts the string specified by the Str parameter to a Variant value that encodes date and 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 value storing date and time. The Str parameter must use the current locale’s date/time format. In the US, this is commonly MM/DD/YY HH:MM:SS format. Specifying AM or PM as part of the time is optional, as are the seconds. Use 24-hour time (7:45 PM is entered as 19:45, for example) if AM or PM is not specified. If Str does not contain a valid date and time, StrToDateTime raises an exception.

Result Value

The integral part of the StrToDateTime method’s return value is the number of days that have passed since 12/30/1899. The fractional part of this value is fraction of a 24-hour day that has elapsed.


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

See Also

Working With Dates
Working With Time
StrToDateTime Method
StrToDate Method
DateTimeToFormatStr Method
DateTimeToStr Method

Highlight search results