Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Days in month
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8
Miscellaneous
Thread ID:
01266644
Message ID:
01266674
Views:
8
>>Try with ldDate = {^2007/1/31}
>>
>>>Get the LastDay of this month:
>>>
>>>? GetLastDay({09/09/2006})
>>>
>>>
>>>FUNCTION GetLastDay(ldDate)
>>>RETURN DAY(GOMONTH(ldDate,1)-DAY(ldDate))
>>>
>
>Why I always forget February?
>
>? GetLastDay(DATE(2007,1,31))
>
>FUNCTION GetLastDay(ldDate)
>LOCAL ldDate1
>ldDate1 = GOMONTH(ldDate,1)
>RETURN DAY(ldDate1-DAY(ldDate1))
>
The problem with your previous code was not only with February but any month that precedes another month with less days and date is the last day of the month. Eg ldDate = {^2007/3/31} would return 30 instead of 31.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform