Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid Date of Birth Entered?
Message
De
19/12/2007 15:15:00
 
 
À
19/12/2007 14:45:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01276653
Message ID:
01276668
Vues:
23
Thanks Dorris, I went with something similar:
	lcCentury = SET('CENTURY')
	lxThisValue = IIF(TYPE('THIS.Value')='T', ;
		TTOD(THIS.Value), THIS.Value)

	SET CENTURY ON
	lxDateValue = IIF(TYPE('lxThisValue')='T', GETaDATE(), GETaDATE("D"))
	SET CENTURY &lcCentury


	*--Check for future date
	IF lxThisValue > lxDateValue
		ldStartValue = this.value
		TRY
			IF TYPE('this.value') = 'T'
				THIS.value = DTOT(CTOD(STR(MONTH(this.value))+'/'+STR(DAY(this.value))+'/'+STR(YEAR(this.value)-100)))
			ELSE
				THIS.value = CTOD(STR(MONTH(this.value))+'/'+STR(DAY(this.value))+'/'+STR(YEAR(this.value)-100))
			ENDIF
		CATCH 
			THIS.value = ldStartValue
			RETURN .F.
		ENDTRY
		IF TYPE("gluse2DigYear")="L" AND gluse2DigYear
			SET CENTURY OFF
		ENDIF
		RETURN .T.
	ENDIF
>If Century is set on, don't they have to enter a 4 digit year?
>
>otherwise, are you looking for something like:
>
>if Year(dtofBirth) > Year(date())
> dtofBirth = ctod(alltrim(str(Month(dtofBirth))) + ;
> alltrim(str(Day(dtofBirth))) + ;
> alltrim(str(Year(dtofBirth)-100)))
>endif
>
>>A user can enter 2 or 4 digit value for the year section in a datetime field: (i.e. 01/01/01 or 01/01/2001)
>>
>>1. If the year is in the future, invalid - set to same date in previous century (i.e. 08 entered, make it 1908, or 2008 entered, make it 1908).
>>2. If the year is between the current century and the current year (2000/00 to 2007/07), assume this century.
>>3. If the year is greater than the current year, set it to the same date in the previous century.
>>
>>For some reason I am not getting this today. It should be so very very simple...
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform