Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to calculate days in a month?
Message
De
14/12/2000 21:20:29
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00453660
Message ID:
00453732
Vues:
26
>Is there a built-in fuction that will return the days in a month from a particular date.
>

FUNCTION DaysInMonth(tdDate)
RETURN DAY(GOMONTH(tdDate-DAY(tdDate)+1,1) - 1)

I'd add error checking - if the parameter passed in is a datetime rather than a date, you need to use the TTOD() of the parameter. You can also just write this in-line.

>Example:
>
>31 days in 1/2/2000
>29 days in 2/2/2000
>but
>28 days in 2/2/2001
>
>I know I could wite a fucntion which will return the days of the 12 months and to include the function to accomated the leap year. I am lokking for a built-in function.
>
>Thanks in advance.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform