Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to get the last day of month
Message
 
À
15/07/1997 19:00:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00039619
Message ID:
00040222
Vues:
44
Well, to tell you the truth, I thought Jim's formula was like this:

NewDate = gomonth(OldDate,1) - day(OldDate)

but, it was really like this:

NewDate = gomonth(OldDate,1) - day(gomonth(OldDate,1))

which I think will work...but he agreed with my comment that it wouldn't work for a few days of the year...so maybe I am missing something...

If his formula was like I had thought (ie. the day() function acting on the original date), it would mess-up on the days where the following month did not have that many days (?!?!?)...January 29 (non-leap years),30,31, March 31, May 31, August 31, October 31...so I can't count! I didn't originally cound Jan. 29 & 30...oh well, atleast we all learned a lesson here. It is difficult to know when the test an algorithm and to give it more thought and when to get on with the next task at hand....that's why I like end users..."Joe, something's wrong here."...that's when I know I should have given something a little more thought.

Take care,
Joe

>Can you tell me which are those 5 days?
>
>Vlad
>
>>The real difference is that your method works all the time and J.B.'s fails for 5 days of the year.
>>
>>Take care,
>>Joe
>>
>>>This is what I already pointed out: is a "BIG" difference... :)) Just figure out the difference for 5x10^10000 repetitions... :))
>>>
>>>Vlad
>>>
>>>> 1 sec. in 500,000 repetitions will REALLY save the user's a lot of time, Vlad :-)
>>>>
>>>>Barbara
>>>>
>>>>>That matters A LOT, especially when you let the user to choose the date format.
>>>>>There are 4 formats with the year first in FoxPro: ANSI, JAPAN, TAIWAN, YMD. Also, this is almost a standard here (as far as I can I say). :)
>>>>>
>>>>>Vlad
>>>>>
>>>>>
>>>>>>Hi Paul!
>>>>>>
>>>>>>I think that it doesn't matter ;), but I can't recall the date format where
>>>>>>year is on the first place...
>>>>>>
>>>>>>Have a happy day
>>>>>>Vladimir Shevchenko
>>>>>>
>>>>>>> This depends on SET DATE (and SET CENTURY if the year is on the first
>>>>>>place
>>>>>>> in SET DATE). :(
Joseph C. Kempel
Systems Analyst/Programmer
JNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform