Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to get the last day of month
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039619
Message ID:
00040001
Vues:
37
Yours will not work with a few dates...for example try August 31st. It will return August 30th.

Needs to be in two steps with the second step using the next month's day.

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
>Vlad,
>
>I think mine will work more often. Yours would fail for certain dates where the previous month had less days than the curretn month, tyr this and see;
>
> SET DATE AMERICAN && not needed but just want to let you know I am using this format
> ldDate = {03/31/97}
>?GoMonth(ldDate,1)-day(gomonth(ldDate,1)) && returns 3/31/97 correctly
> ?GoMonth(ldDate-day(ldDate),1) && Returns 3/28/97 incorrectly because Feburary has only 28 days
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