Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating how many days have passed in a year?
Message
De
02/12/1998 12:47:52
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00163001
Message ID:
00163285
Vues:
21
>Is there an easy way to calculate how many days have passed since New Year's? I want to make sure it takes consideration of leap year too.

This should do the job:
STRDAYONE = "{^" + STR(YEAR(YOURDATE)) + "/01/01}"
DAYSELAPSED = 1 + (YOURDATE - &STRDAYONE)
The {^ xx/xx/xx} format was announced for VFP 6, but it works in VFP 5 too; by using it you avoid any SET DATE TO problems.

HTH!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform