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:
00039661
Vues:
46
>>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform