Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to get the last day of month
Message
De
12/07/1997 11:49:41
 
 
À
12/07/1997 04:15:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039619
Message ID:
00039672
Vues:
51
This depends on SET DATE (and SET CENTURY if the year is on the first place in SET DATE). :(

Vlad

>Hi! Jim!
>
>you can try the following:
>
>ldDate = {31.03.97}
>lcSeparator = substr(dtoc(ldDATE),3,1)
>ldBegDate =CTOD([01]+lcSeparator+substr(dtoc(ldDate),4))
>ldEndDate = gomonth(ldBegDate,1)-1
>
>May be it be it not so short but it always return correct result...
>
>Have a happy day
>Vladimir Shevchenko
>
>> 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 >
>?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