Information générale
Catégorie:
Codage, syntaxe et commandes
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement