Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find last date in a month
Message
From
22/01/2007 13:43:28
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01187758
Message ID:
01187770
Views:
17
>>Is there a quick way to find the last date in any given month. I need to select records that fall within the selected month and year. I was going to use the between() command but how can you select the last date of a month (28,30,31) without lines of code?
>
>? LastDay(DATE())      && Just day
>? LastDay(DATE(), .t.) && We want DATE
>
>
>FUNCTION LastDay(ldDate, lbDateWant)
> LOCAL ldLastDay
> ldLastDay = GOMONT(ldDate,1)-DAY(ldDate)
>RETURN IIF(lbDateWant, DAY(ldLastDay), ldLastDay)
>
Borislav,

Try with {^2006/01/30}

Since every month has a first, go back to the first of the month, add one month, subtract one day
?gomonth(m.d+1-day(m.d), 1) -1
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform