Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Years and months between two dates
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00160317
Message ID:
00161949
Vues:
29
George,

Here's a pretty simple one;
LPARAMETERS pdDate1, pdDate2
LOCAL ldDate1, ldDate2, ldLastDate, lnYears, lnMOnths, lnDays
ldDate1 = MIN(pdDate1,pdDate2)
ldDate2 = MAX(pdDate1,pdDate2)
lnYears = 0
lnMonths = 0
lnDays = 0

DO WHILE ldDate2 > ldDate1
	ldLastDate = ldDate1
	ldDate1 = GOMONTH(ldDate1,1)
	lnMonths = lnMonths + 1
	IF lnMonths = 12
		lnYears = lnYears + 1
		lnMonths = 0
	ENDIF
ENDDO

lnDays = ldDate2 - ldLastDate

? "Years: "
?? lnYears
?"Months: "
?? lnMonths
? "Days: "
?? lnDays
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform