Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET DATE SHORT problem
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00812043
Message ID:
00812092
Views:
13
This works and is almost like SET DATE SHORT in functionality:
*	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--
>
>If you issue SET DATE SHORT, VFP no longer handles any dates before
>{^1601-01-01}. It throws an DATE/DATETIME EVALUATED TO AN INVALID VALUE any time you attempt to use a date prev to 1601 in any way.
>
>Are any of you Microsoft guys aware of the problem so it can get fixed?
>
>Thanks,
>
>Dennis
Previous
Reply
Map
View

Click here to load this message in the networking platform