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
 
 
À
10/11/2000 12:43:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00440276
Message ID:
00440344
Vues:
20
>>>>Is there a function that returns the number of days in a month?
>>>>example...
>>>>jan has 31 days
>>>>days_in_a_month = (some_function,jan)
>>>>?days_in_a_month
>>>>31....any ideas?
>>>
>>>Nope but try
>>>
>>>** gets number of days in given month
>>>ldDate = DATE() && or whatever
>>>ldFirst = DATE(YEAR(ldDate), MONTH(ldDate), 1)
>>>lnDaysInMonth = GOMONTH(ldFirst,1)-ldFirst

>>
>>Actually, you don't need the first 2 lines,
>>IOW
>>
>>lnDaysInMonth = GOMONTH(ldDate,1)-ldDate
>-------------
>works great...thanks everybody....:)))


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

Below is corrected version

lnDaysInMonth = GOMONTH(ldDate-Day(ldDate)+1,1)-1
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform