[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 CTOD()
 Convert a date string to a date value
------------------------------------------------------------------------------
 Syntax

     CTOD(<cDate>) --> dDate

 Arguments

     <cDate> is a character string consisting of numbers representing the
     month, day, and year separated by any character other than a number.
     The month, day, and year digits must be specified in accordance with the
     SET DATE format.  If the century digits are not specified, the century
     is determined by the rules of SET EPOCH.

 Returns

     CTOD() returns a date value.  If <cDate> is not a valid date, CTOD()
     returns an empty date.

 Description

     CTOD() is a character conversion function that converts a character
     string to a date.  To initialize an empty date for date entry, specify
     <cDate> as a null string (""), SPACE(8), or "  /  /  ".

     CTOD() is used whenever you need a literal date value.  Some examples
     are:

     .  Initializing a variable to a date value

     .  Specifying a literal date string as an argument of a RANGE
        clause of @...GET

     .  Specifying a literal date string in order to perform date
        arithmetic

     .  Comparing the result of a date expression to a literal date
        string

     .  REPLACEing a date field with a literal date string

     CTOD() is the inverse of DTOC() which converts a date value to a
     character string in the format specified by SET DATE and SET CENTURY.
     DTOS() also converts a date value to a character string in the form
     yyyymmdd.

 Examples

     .  This example uses CTOD() to initialize two date variables,
        using one as a GET and the other for RANGE validation:

        SET CENTURY ON
        dBegin := CTOD("01-26-1876")
        dCurrent := CTOD("")
        @ 10, 10 SAY "Enter date:" GET dCurrent ;
              RANGE dBegin, DATE()
        READ

     .  This example uses CTOD() to create a date value within a FOR
        condition:

        USE Inventory NEW
        REPLACE ALL Inventory->Price WITH ;
           Inventory->Price * 1.1 FOR ;
           Inventory->InvDate < CTOD("10/10/90")

 Files   Library is CLIPPER.LIB.


See Also: DATE() DTOC() DTOS() SET CENTURY SET DATE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson