Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to get the last day of month
Message
De
15/07/1997 18:49:29
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039619
Message ID:
00040108
Vues:
37
Thanks. Jim Booth already pointed out that my formula was wrong. I fixed now... :))

Vlad

>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform