BUG: LUPDATE() Does Not Report Correct Century for Year 2000

Last reviewed: March 20, 1998
Article ID: Q176481
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a
  • Microsoft FoxPro for Windows, versions 2.6, 2.6a
  • Microsoft FoxPro for MS-DOS, versions 2.6, 2.6a
  • Microsoft Visual FoxPro for Macintosh, version 3.0b
  • Microsoft FoxPro for UNIX, version 2.6
  • Microsoft FoxBASE+ for MS-DOS, version 2.1
  • Microsoft FoxBASE+ for Macintosh, version 2.01
  • Microsoft FoxPro for Macintosh, version 2.6a

SYMPTOMS

When you use SET CENTURY ON with a computer that has the system date set to the year 2000 and a modification is made to the structure of a table (.dbf) file, or a copy of the table file is made, the LUPDATE() function incorrectly displays the century as 1900.

CAUSE

The date of the last update is stored in the header of the .dbf file. The LUPDATE() function reads the date of last update from the header of the .dbf file. This problem is caused by the manner in which FoxPro writes the date into the table's file header.

RESOLUTION

Here are two workarounds:

  • Use the FDATE() function to obtain the correct date. With SET CENTURY ON, this function returns the correct year.

    -or-

  • Create a program subroutine with the ADIR() function to obtain the file date parameter as illustrated by the following program code:

          SET CENTURY ON
          =ADIR(afileinfo, "CUSTOMER.DBF")
          x = afileinfo(1, 3)
          ? x
    

NOTE: Because FoxBase does not support either the FDATE() or ADIR() function, these workarounds do not apply to FoxBase.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The LUPDATE() function returns the date of the last update to the table in the currently selected work area or in a specified work area. The "last updated" date and time are not updated by the operating system until the file is closed. When you close a modified table, FoxPro writes the current system date of the computer into the header of the table file.

With a network, there is no guarantee that all the computers have a synchronized date and time. If the LUPDATE() function makes it appear that the table has not been updated today and then new information is entered into the table, you could be overwriting new data entered from a computer that has the wrong system date.

Steps to Reproduce Behavior

  1. Change the computer's system date to 02/01/2000 (the specific date is not critical as long as the year is 2000 or higher).

  2. In the FoxPro Command window, type the following without the comments:

          SET CENTURY ON
    
          USE <tablename>     && Name of the table.
          ?LUPDATE()          && Checks the current value of the last updated
                              && date.
          APPEND BLANK        && Appends a blank record to the table.
          USE                 && This closes the table.
          USE <tablename>     && Open the table again.
          ?LUPDATE()          && Check the last updated date again.
    
       An incorrect answer is returned: 02/01/1900.
    
    
NOTE: Remember to reset your computer system date back to today's date. (c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Perry Newton, Microsoft Corporation

REFERENCES

For more information about the LUPDATE(), FDATE(), and ADIR() functions, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q130165
   TITLE     : PRB: LUPDATE() Does Not Return Date of Last Update

   ARTICLE-ID: Q113943
   TITLE     : New and Enhanced Commands and Functions in FoxPro Ver 2.6

   ARTICLE-ID: Q100554
   TITLE     : Using ADIR() Function to Obtain MS-DOS File Information

Microsoft FoxPro Help, "LUPDATE() Function" Microsoft FoxPro Help, "FDATE() Function" Microsoft FoxPro Help, "ADIR() Function"

Additional query words

Keywords          : FoxDos FoxMac FoxUnix FoxWin FxenvGeneral FxprgTable VFoxMac vfoxwin
Version           : MACINTOSH:2.01,2.6a,3.0b; MS-DOS:2.1,2.6,2.6a; UNIX:2.6; WINDOWS:2.6,2.6a,3.0,3.0b,5.0,5.0a
Platform          : MACINTOSH MS-DOS UNIX WINDOWS
Issue type        : kbbug


================================================================================


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.