* Executes SET DATE, SET CENTURY, and SET MARK to match the control panel * short date. * * Usage: DO SETDATESHORT * * Workaround for a problem with VFP 7 and 8 where SET DATE SHORT will * not support dates prior to 1601. This normally would not be a problem, * except that if someone accidentally types a date before then, no user-level * editing is performed and VFP throws an error. * * by Dennis Hevener http://hosenose.com LOCAL OD, Tmp oD = NEWOBJECT("SetShort") SET DATE(od.format) tmp = od.century SET CENTURY &tmp SET MARK TO (od.mark) DEFINE CLASS SetShort as Session Century="" Format="" Mark="" PROCEDURE init SET DATE short LOCAL cResults cResults = DTOC({^2013-12-11}) * See if century is returned this.century = IIF(LEN(cResults)=10, "ON", "OFF") * Determine SET DATE DO case CASE LEFT(cResults,2)="11" this.format="DMY" CASE LEFT(cResults,2)="12" this.format="MDY" OTHERWISE this.format="YMD" ENDCASE * now determine mark. It will be in either 3rd or 5th character * 2003-12-12 * 12-12-2003 this.mark = ; IIF(ISDIGIT(SUBSTR(cResults,3,1)), SUBSTR(cResults,5,1), SUBSTR(cResults,3,1)) ENDPROC ENDDEFINE>Hi--