Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Last day of a month
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00287143
Message ID:
00288057
Vues:
15
>>>Your formula is a little slower than the other one because it uses GOMONTH twice. It also has 5 function calls vs. 4 in the other one.
>>>
>>>But, IMO, it is more readable/clear.
>>>
>>>Vlad
>>>
>>>>How about GOMONTH( DATE(),1 ) - DAY( GOMONTH( DATE(),1 ) )
>>>>I guess there's many ways to skin a cat.
>>
>>Actually, the code I use to get the last date of the month looks like
>>
>>ldLastDay = GOMONTH( DATE(),1 )
>>ldLastDay = ldLastDay - DAY( ldLastDay )
>
>Well, that'll take even longer since you're using 2 lines where only 1 line is necessary.
>
>But we continue to split hairs, simply for the sake of discussion.

Actually, I think there's an important point here. More lines of code on the foxpro level does not necessarily mean more code at the machine level. At one point that was believed to be true and at the sacrifice of readability, everyone started using IIF's instead of the IF ELSE constructs. To be honest, without testing the above, I really couldn't tell you, but I believed that the above would be faster because it only makes one function call.

I am certainly willing to be wrong, but I am curious to see some benchmarks.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform