Functions and Directives

Function DtoC() Foundation

Converts a date value to a character string.

DtoC( <dDate> ) --> cDate
<dDate> is a date expression the value of which is converted to a character string.

DtoC() returns a date value as a character string. The return value is formatted according to the date format defined with SET DATE. With an empty date, a string of blank spaces equal in length to the current date format is returned.


DtoC() is a conversion function which can be used to format date values when the date needs to be displayed as a character string in the current SET DATE format. Other date formats can be made available with the function Transform() or by using other conversion functions like CDow() and CMonth().

When a date value is used in the index key of an INDEX file, the function DtoS() must be used instead of DtoC() for correct sorting of date values.

// The example shows results of the function DtoC() 

   ? Date()              // result: 12/06/94 
   ? DtoC(Date())        // result: "12/06/94" 
   ? "New Year's Eve is on " + DtoC(Date() +25) + "!" 
                         // result: "New Year's Eve is on 12/31/94!" 

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.