Click to Rate and Give Feedback
MSDN
MSDN Library
Visual FoxPro
Reference
Language Reference
Functions
 DTOC( ) Function
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual FoxPro 9.0 SP2
DTOC( ) Function

Returns a Character-type date from a Date or DateTime expression.

DTOC(dExpression | tExpression [, 1])

Parameters

dExpression

Specifies a Date-type variable, array element, or field for which DTOC( ) returns a Character-type date.

tExpression

Specifies a DateTime-type variable, array element, or field for which DTOC( ) returns a Character-type date.

1

Returns the date in a format suitable for indexing. This is particularly useful for maintaining the table records in chronological sequence.

For example, to order table records in entry sequence, you could issue this command:

INDEX ON DTOC(gdInvDate, 1) + gnInvTime TAG Timeindx

gdInvDate and gnInvTime are fields containing the date and time when the data was entered in the record.

Character

DTOC( ) returns a character string corresponding to a Date or DateTime expression. The date format is determined by SET CENTURY and SET DATE.

SET STRICTDATE TO 1
STORE CTOD('10/31/98') TO gdThisDate
CLEAR
? DTOC(gdThisDate)
STORE DTOC({^1998-10-31}+90) TO gcExpireDate
? 'Your 90-day warranty expires ', gcExpireDate
? DTOC({^1998-10-31},1)
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker