How to Modify a Character Field to Resemble a Date Field

ID: Q96298

The information in this article applies to:

To modify a character field containing numbers so that the numbers resemble date fields (for example, "010292" is changed to "01/02/92"), do the following:

1. Create a database with a field called "date". Define the field as

   character, eight spaces wide.

2. Input sample records, for example:

      010292
      020192
      030192

3. Use the following code, which inserts the slash (/) so that the
   information in the record will look like it has been defined as a
   date field:

      REPLACE ALL <fieldname> WITH SUBSTR(date,1,2) + "/" ;
         + SUBSTR(date,3,2) + "/" +SUBSTR(date,5,2)

Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a convert KBCategory: kbprg KBSubcategory: FxprgGeneral

Last Reviewed: June 27, 1995