TTOC( ) Function

Example   See Also

Converts a DateTime expression to a Character value of a specified format.

Syntax

TTOC(tExpression [, 1 | 2])

Returns

Character

Arguments

tExpression

Specifies a DateTime expression from which TTOC( ) returns a Character value. If tExpression contains only a time, Visual FoxPro adds the default date of 12/30/1899 to tExpression. If tExpression contains only a date, Visual FoxPro adds the default time of midnight (12:00:00 A.M.) to tExpression.

1

Specifies that TTOC( ) return a Character string in a format suitable for indexing. The character string has a 14 character yyyy:mm:dd:hh:mm:ss format that is not affected by the current settings of SET CENTURY or SET SECONDS.

2

Specifies that TTOC( ) return a Character string consisting of only the time portion of the DateTime expression. The settings of SET SECONDS and SET DATE specify if the seconds portion of the time is included in the character string. Note that if SET DATE is set to LONG or SHORT, the format of the character string is determined by the format of the Control Panel time setting.