Bagikan melalui


TTOD( ) Function

Returns a Date value from a DateTime expression.

TTOD(tExpression)

Return Values

Date

Parameters

  • tExpression
    Specifies a date and time expression from which TTOD( ) returns a Date value. tExpression must evaluate to a valid DateTime. If tExpression contains only a time, Visual FoxPro adds the default date of 12/30/1899 to tExpression and returns this default date.

Example

The following example creates a Datetime type variable named gtDtime. TYPE( ) displays T, indicating the variable is a Datetime type. TTOD( ) is used to convert the variable to a date type, and TYPE( ) now displays D, indicating the variable is a date type after the conversion.

STORE DATETIME( ) TO gtDtime  && Creates a Datetime type memory variable
CLEAR
? "gtDtime is type: "  
?? TYPE('gtDtime')  && Displays T, Datetime type value

gtDtime = TTOD(gtDtime)     &&  Converts gtDtime to a date value
? "gtDtime is now type: "  
?? TYPE('gtDtime')  && Displays D, character type value

See Also

DATE( ) | DATETIME( ) | HOUR( ) | MINUTE( ) | SEC( ) | SECONDS( ) | SET CENTURY | SET SECONDS | TIME( ) | TTOC( )