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:07:03
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:
01137093
Views:
22
>>>No, that wouldn't work, either. Say the dates for the pay period are 6/20 to 7/4. The 12th isn't between those 2 dates.
>>
>>It wouldn't find what it wasn't supposed to find - which is just what was required. I also first thought this was wrong, but it's actually right. So if neither 6/12 nor 7/12 is between 6/20 and 7/4, good, don't include that period.
>
>That's true, but I think it's right for the wrong reason. It all depends on what constitutes a pay period, I'd think. BETWEEN wouldn't find it if it was 6/30 to 7/13 either, in which case it would NOT be right that it wasn't found.

Now that IS a good example of when it wouldn't work, because while 7/12 is between these two dates, between(12, 30, 13) will return .f.

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

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform