Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding the payperiod that included 12th of month
Message
From
17/07/2006 19:18:40
 
 
To
17/07/2006 19:15:29
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01137078
Message ID:
01137100
Views:
17
>>>So... let me think. Q&D solution:
>>>
>>>
* try with 12th of the first date's month
>>>d12=date(year(d1), month(d1), 12)
>>>*-- if first date is past 12th, use 12th of the second date
>>>if d12<d1
>>>  d12=date(year(d2), month(d2), 12)
>>>endif
>>>scan for between(d12, d1, d2)
>>>  && do stuff here
>>>endscan
>>
>>I think this would work (uses Julian date):
>>
>>
BETWEEN(SYS(11,DATE(YEAR(PpBeg),MONTH(PpBeg),12)),SYS(11,PpBeg),SYS(11,PpEnd)) ;
>   OR BETWEEN(SYS(11,DATE(YEAR(PpEnd),MONTH(PpEnd),12)),SYS(11,PpBeg),SYS(11,PpEnd))
>
>I was also tempted to make it a one-liner but resisted it for clarity's sake. Payroll report never hinges on a couple of milliseconds more or less.

I didn't realize how big this would be until after I posted it. I built it up with a cut & paste of the two parts. Thanks for making it more readable.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform