Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a function that returns the number of days in a
Message
De
10/11/2000 14:35:59
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00440276
Message ID:
00440392
Vues:
14
>>>lnDaysInMonth = GOMONTH(ldDate,1)-ldDate
>>-------------
>>works great...thanks everybody....:)))
>

>Nope. It doesn't work properly for January 30-31 in particular.
>

Yeah, yeah, yeah :) I caught this a little bit after I posted it, and replied to myself with the fix.
I like yours better, though. <g>

Yep - doesn't work for any date where the next month doesn't have that date. Like Jan 29-31 (in non-leap years), October 31, etc.

>Below is corrected version
>
>lnDaysInMonth = GOMONTH(ldDate-Day(ldDate)+1,1)-1

BTW, that gets the last day of the month, not the number of days.

lnDaysInMonth = DAY(GOMONTH(ldDate-Day(ldDate)+1,1)-1)

gets # of days.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform