Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid Date of Birth Entered?
Message
 
À
19/12/2007 14:21:23
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:
01276665
Vues:
13
This message has been marked as a message which has helped to the initial question of the thread.
>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).
* Valid Event
IF YEAR(this.Value) > YEAR(DATE())
   *** Just in case somebody enter 3007 or 4007
   *** but I have no idea what you want if the user enters: 3598?
   *** what it should be: 1598 or 1998?    
*   this.Value = DATE(YEAR(this.Value)-100, MONTH(this.Value),DAY(this.Value))
    lnYear = 1900+VAL(RIGHT(TRANSFORM(YEAR(this.Value)),2))
    this.Value = DATE(lnYear, MONTH(this.Value),DAY(this.Value))
ENDIF
I thought about GOMONTH(this.Value, -12*100) but not sure if this will work correctly.


>2. If the year is between the current century and the current year (2000/00 to 2007/07), assume this century.

SET CENTURY ON ROLLOVER xxxx is enough

>3. If the year is greater than the current year, set it to the same date in the previous century.
>

See No.1 (I think it is the same)


>For some reason I am not getting this today. It should be so very very simple...
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform