Utilities.FormatDateTime Method

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


Use the Utilities.FormatDateTime method to convert DateTime to a string using the format specified by the Format parameter.


Utilities.FormatDateTime(Format, DateTime)

Format [in]    Required    String    
DateTime [in]    Required    Variant    
Result String

Applies To

The method is applied to the following object:


The method has the following parameters:


Specifies the format used to convert the given DateTime value to a string. For more information on supported format specifiers, see Date and Time Format Specifiers.


Specifies the DateTime value to be converted to a string.

Result Value

The given DateTime value converted to a string.


This method is obsolete. It is supported for backward compatibility only. To convert a DateTime value into a string in a specific format, use the aqConvert.DateTimeToFormatStr method.

The function name, FormatDateTime, coincides with the name of a VBScript function. These functions have the same names but different parameters. So, if you need to call FormatDateTime from a VBScript code, you should also specify the object name - Utilities. That is, use Utilities.FormatDateTime(...) rather than just FormatDateTime(...). If you omit the object name, TestComplete will call VBScript’s function and since its parameters differ from parameters of Utilities’s function, you will get the “Type mismatch” error.

See Also

Working With Dates
Working With Time
Date and Time Format Specifiers
Format Method
DateTimeToFormatStr Method
DateTimeToStr Method
Today Method
Now Method
Time Method

Highlight search results