Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many Sundays in a month?
Message
De
21/03/2001 18:09:10
 
 
À
21/03/2001 17:19:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00487391
Message ID:
00487441
Vues:
5
I tried a function on this. Worked for the months of this year, but didn't test others.
lnMonth = 3
lnYear = 2001

IIF(dow(date(lnYear,lnMonth,1))=1,1,9-dow(date(lnYear,lnMonth,1)))  && first Sunday in month

gomonth(date(lnYear,lnMonth,1),1)-date(lnYear,lnMonth,1)    && no. of days in month

If first Sunday + 28 days (4 more Sundays) is less < = no. of days in month,
we have 5 Sunday, otherwise there are 4.  So the function is:

IIF((IIF(dow(date(lnYear,lnMonth,1))=1,1,9-dow(date(lnYear,lnMonth,1)))+28) <= (gomonth(date(lnYear,lnMonth,1),1)-date(lnYear,lnMonth,1)),5,4)
Rod Poujade
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform