Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Year 2018 to 1918 Date Math
Message
De
15/03/2005 14:05:05
 
 
À
15/03/2005 13:55:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00995917
Message ID:
00996042
Vues:
19
Okay, That way, the computer tells me it is a bad date. I didn't really look at your example's month and day, bacause the computer did not tell me it was bad. What happens if the code is inside a UDF and hits another non-leap year date? I knows there has got to be a case where this can happen, since the forumla for finding leap years has a 400 in it. (Not likely, but possible). I am not trying to start an debate on this, I just wanted to comment on since I hit the problem while lurking.
Have a great day.
Beth
>>PMFJI, but your example failed also, when you change the year, because of the leap year problem. I tried to change the year to the year that was stated in the begining of the thread (2018), and the date came back empty. So it is not fool-proof.
>>
>>>Sergey, the second is simpler,faster and it is the only solution;
>>>the first can fail:
>>>
>>>dob=DATE(2000,2,29)
>>>? DATE(YEAR(dob)-100, MONTH(dob), DAY(dob))
>>>? GOMONT(dob, -100*12)
>>>
>
>Beth, failed ?
>with DATE(2018,2,29) you start with a bad data, then any date computation with a empty date return a empty date;
>the likeable thing is that writing DATE(2018,2,29) you have applied the problem directly that I have described.
>
>
>* i have uses DATE(2000,2,29) because on Italian keyboard the {} are not presents
>* try this
>dob={^2018/2/29}
>? DATE(YEAR(dob)-100, MONTH(dob), DAY(dob))
>? GOMONT(dob, -100*12)
>
>
>Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform