Utilities.FormatDateTime Method

Applies to TestComplete 15.47, last modified on January 20, 2023
This method is obsolete. See the Remarks section below.

Description

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

Declaration

Utilities.FormatDateTime(Format, DateTime)

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

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Format

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.

DateTime

Specifies the DateTime value to be converted to a string.

Result Value

The given DateTime value converted to a string.

Remarks

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