Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set century
Message
 
 
To
12/05/2005 11:03:16
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01013353
Message ID:
01013432
Views:
14
>
>2005 % 100
>
>and the century with:
>
>int(2005 / 100)

Right.

Now I'm having one little problem. If I type 7/1/05, I want to transform it to 7/1/1905. But the problem is with leap years and 02/29.
Here is what I've written so far, may be you can help me out a little bit:
*---------------------- Location Section ------------------------
*   Library: 	Acustomcontrols.vcx
*   Class: 		TxtDOB
*   Method: 	Valid()
*----------------------- Usage Section --------------------------
*)  Description:
*)

*   Scope:      Public
*   Parameters:
*$  Usage:
*$
*   Returns:
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	04/19/2005 - NN
*		MODIFIED    04/20/2005 - NN
*----------------------------------------------------------------
local llReturn, lcYear, lnYear
if this.lValidationCancelled
	llReturn = .t.
	this.lValidationCancelled = .f.
else
	llReturn = not empty(dodefault())
	if m.llReturn
		lcYear = ALLTRIM(substr(this.text,rat('/',this.text)+1,4))
		if LEN(m.lcYear)<3 AND val(m.lcYear) = int(year(date())%100) && Same year typed as 2 digits
		    this.Value = IIF(this.value > DATE(), DATE(YEAR(this.Value)-100,MONTH(this.Value),
			if this.value > date()
				llReturn = .f.
				=ErrorMsg ("Date of birth could not be greater than today's day!")
			endif
		endif
	endif

	return m.llReturn
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform