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:47:06
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039619
Message ID:
00039671
Vues:
39
You're right, of course. Thank you.

I looked in a program and what I used is

GoMonth( ldDate - Day( ldDate) + 1, 1) - 1

I think this is always correct.

I've done a speed test and this is about 10% faster than yours (probably because it calls GoMonth just once), but it doesn't matter since it gives about 1 second difference when you call them around 500,000 times. :) At least on my computer...

Thanks again and sorry for this mistake.

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

Click here to load this message in the networking platform