PRB: Problems Importing Dates from Lotus Spreadsheet to FoxPro

Last reviewed: March 20, 1998
Article ID: Q88860
2.00 2.50 2.50a 2.50b 2.60 | 2.50 2.50a 2.50b 2.60
MS-DOS                     | WINDOWS
kbprg kbprb

The information in this article applies to:

  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, 2.5b, 2.6
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6

SYMPTOMS

Under some circumstances, when the IMPORT command is used to load dates from a Lotus spreadsheet into a FoxPro database, FoxPro loads the Lotus date number and does not properly translate the value to a date. The date may be imported as a character value or as a numeric value.

RESOLUTION

To correct this problem, do the following:

  1. Use the MODIFY STRUCTURE command to create an additional date field.

  2. If the date number was imported as a numeric value, execute the following command to copy the date to the new field:

          REPLACE ALL <new_field> WITH
    
             CTOD(SYS(10,<old_field>+2415019))
    
       If the date number was imported as a character value, execute the
       following command to copy the date to the new field:
    
          REPLACE ALL <new_fld> WITH
             CTOD(SYS(10,VAL(<old_fld>)+2415019))
    
    

  3. Use the MODIFY STRUCTURE command to delete the original (incorrect) date field.

MORE INFORMATION

Lotus stores dates as the (nonnegative) number of days from January 1, 1900. The number 2415019 is the corresponding Julian date. By adding this offset to the Lotus date value, FoxPro can correctly translate the date.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 123 Symphony WR1
2.50b 2.60
KBCategory: kbprg kbprb
KBSubcategory: FxinteropSpread



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 20, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.