Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Number of days in a month
Message
De
11/10/1997 16:03:45
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00053634
Message ID:
00054193
Vues:
39
>>>Is there a function to get the number of days in a month.
>>>eg. the number of days in any month of any year.
>>>
>>>Thanks
>>>Andrew
>>
>>As long as I know VFP does not have a function for this, but is very easy you can make your own such as this
>>
>>Function DaysOfMonth
>>Lpara tnMonth, tnYear
>>*-- have to pass the year also as parameter to find out if is a leap year
>>
>>do case
>> case tnMonth=1
>> return 31
>> case tnMonth=2
>> if mod(tnYear,4)=0 &&leap year
>> return 29
>> else
>> return 28
>> endif
>> case tnMonth=3
>> return 31
>>etc...
>>etc...
>>endcase
>
>
>I TOOK A PEAK AT WHAT I DID FOR #OFDAYS -
>MY WAY, YOU MUST TAKE IN CONSIDERATION THE NEXT MONTH PAST 12
>IS 1 IN NEW YEAR. THE CORRECT CODE (NOT WHAT I MENTIONED BEFORE):
>dWHEN= {2/12/96}
>? DAY(CTOD(str(IIF((Month(dWHEN)+1 > 12),1,(Month(dWHEN)+1)));
>+"/01/";
>+Alltrim(SUBSTR(STR(IIF((Month(dWHEN)+1 > 12),;
> Year(dWHEN)+1,Year(dWHEN))),7,4)))-1)
>
>PAULS RIGHT- BEWARE of how SET DATE
>
>Ed B

Ed,
Please post messages in lowercase or mixed case, CAPS ARE CONSIDERED SHOUTING in online communication.

Thanx!

Tony Miller
Vancouver,Wa
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform