Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to get the last day of month
Message
 
À
11/07/1997 19:36:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039619
Message ID:
00039965
Vues:
44
Try that with, say 97/03/01, or May, or July, or...I don't think it works.

You are assuming that the previous month has as many days as the current month.

Try two steps:

lcDate = GoMonth(ldMyDate,1)
lcDate = lcDate - day(lcDate)

This way you are taking advantage of the fact that the FoxPro gomonth() function takes care of the problems with 'uneven' months. For example, gomonth({97/08/31}, 1) gives you {97/09/30}, and you then work with 30 (not 31) for your subtraction.

Take care,
Joe


>>>The easiest way I know:
>>>
>>>lcDate=GoMonth(ldMyDate-day(ldMyDate),1)
>>>
>>>This doesn't depend on SET CENTURY or SET DATE, it works for leap years, etc.
>>
>>Thanks a lot. It does the job perfectly.
>
>Perfectly and excatly! :)
>
>You're welcome.
>
>Vlad
Joseph C. Kempel
Systems Analyst/Programmer
JNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform