This is a very old date problem .. in a date field with Century ON ( 4 digit date ) .. if you edit the last digit of the year as in these pictures .. and change from 6 to 7 .. as you can see you get an invalid date "04/25/0207" that if not caught, will load itself into a .dbf date field and cause all kinds of havoc with reports ..
Here is a very simple example:
- Code: Select all Expand view
// testdate.prg
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
Function Main()
Local oDlg, oBtn, oDate, dDate,nYear
SET DELETED on
SET CENTURY on
SET 3DLOOK on
nYEAR := ( year( DATE() )-30 )
SET EPOCH to ( nYEAR )
dDate := date()
DEFINE DIALOG oDlg FROM 5, 5 TO 25, 40 TITLE "Testing Dates"
@ 2, 2 GET oDate var dDate OF oDlg
@ 4,10 BUTTON "&Quit" OF oDlg SIZE 40,12 ;
ACTION oDlg:End()
ACTIVATE DIALOG oDlg
return nil
// end