Microsoft KB Archive/176481

= FIX: LUPDATE Does Not Report Correct Century for Year 2000 =

Article ID: 176481

Article Last Modified on 3/10/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft FoxPro 2.6 Standard Edition
 * Microsoft FoxPro 2.6a Standard Edition
 * Microsoft FoxPro 2.6 for MS-DOS
 * Microsoft FoxPro 2.6a Standard Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh
 * Microsoft FoxPro 2.6 for SCO/UNIX
 * Microsoft FoxBASE+ 2.5 for MS-DOS
 * Microsoft FoxBASE+ 2.01 for Macintosh
 * Microsoft FoxPro 2.6a Professional Edition for Macintosh

-



This article was previously published under Q176481



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
Use one of the following workarounds:  Use the FDATE function to obtain the correct date. With SET CENTURY ON, this function returns the correct year.  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 that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual FoxPro6.0.



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
 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).  In the FoxPro Command window, type the following without the comments:

SET CENTURY ON     USE         && 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        && Open the table again. ?LUPDATE             && Check the last updated date again.

An incorrect answer is returned: 02/01/1900. </li></ol>

NOTE: Remember to reset your computer system date back to today's date.

<div class="references_section">