Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function to get the last day of month
Message
From
15/07/1997 18:49:29
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00039619
Message ID:
00040108
Views:
39
Thanks. Jim Booth already pointed out that my formula was wrong. I fixed now... :))

Vlad

>Try that with, say 97/03/01, or May, or July, or...I don't think it works.
>
>You are assuming that the previous month has as many days as the current month.
>
>Try two steps:
>
>lcDate = GoMonth(ldMyDate,1)
>lcDate = lcDate - day(lcDate)
>
>This way you are taking advantage of the fact that the FoxPro gomonth() function takes care of the problems with 'uneven' months. For example, gomonth({97/08/31}, 1) gives you {97/09/30}, and you then work with 30 (not 31) for your subtraction.
>
>Take care,
>Joe
>
>
>>>>The easiest way I know:
>>>>
>>>>lcDate=GoMonth(ldMyDate-day(ldMyDate),1)
>>>>
>>>>This doesn't depend on SET CENTURY or SET DATE, it works for leap years, etc.
>>>
>>>Thanks a lot. It does the job perfectly.
>>
>>Perfectly and excatly! :)
>>
>>You're welcome.
>>
>>Vlad
Previous
Reply
Map
View

Click here to load this message in the networking platform