Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set century
Message
From
12/05/2005 11:24:17
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:
01013441
Views:
11
This message has been marked as a message which has helped to the initial question of the thread.
For example, gomonth(SomeDate, -100*12) will subtract 100 years. VFP does all the required calculations.

>>
>>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
>
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform