Mohit Sindhwani wrote:
> Anyway, if you have:
> 
> now = DateTime.now
> this_month = now.month
> this_budget_fencepost = \\\ based on what we discussed earlier ///
> 
> then, you can find the budget fencepost for today using that..
> 
> If your budget posts are every 4 weeks from the last Sunday of January,
> you should be able to get the number of days since the first
> num_of_days = this_budget_fencepost - first_fencepost
> fencepost_number = num_of_days/ 28
> 
> You need to put in some check if the date is earlier than the first
> fencepost and check the numbers it actually produces, but roughly that
> should do it for you.
> 
> Cheers,
> Mohit.
> 9/26/2007 | 10:59 PM.

I basically just did a comparsion for the time.now between each of the 
budget periods. If between 0 and 1, then budget1; if between 1 and 2, 
then budget2, and so on. A little painful, but it's done with about 12 
lines of code. I can live with that. Thanks.


-- 
Posted via http://www.ruby-forum.com/.