```OK, I'm confused - is your budget fencepost the last Sunday or the
Sunday every 4 weeks from the end of Jan?

Cheers,
Mohit.
9/26/2007 | 10:56 PM.

Peter Bailey wrote:
> OK. Now, I've got that last Sunday's date in January. And, I've now
> delineated all of the successive Sundays thereafter. Each of them is a
> budgetary fencepost for me. So, can someone help me to determine what
> budget period, out of all 13 of them, that today's date, or any day for
> that matter, would fall into? I think that all of my budget dates below
> are actually strings, so, they don't parse with dates as they are.
>
> Thanks,
> Peter
>
> Here's what I have now. It works. I just need to see what today, or any
> day, would fall into.
>
> require 'date'
> now = DateTime.now
> year = now.year
> d = Date.new(now.year, 2, 1)
> d.to_s
> d -= 1
> d.to_s
> d -= d.wday
> i = d.wday
> d.to_s
> firstbudgetfence = d
>
> t = Time.now
> t = t.strftime("%Y-%m-%d")
> budget1   = Date.new(now.year, 1, 1)
> budget2   = firstbudgetfence
> budget3   = firstbudgetfence + 28
> budget4   = budget3 + 28
> budget5   = budget4 + 28
> budget6   = budget5 + 28
> budget7   = budget6 + 28
> budget8   = budget7 + 28
> budget9   = budget8 + 28
> budget10   = budget9 + 28
> budget11   = budget10 + 28
> budget12  = budget11 + 28
> budget13  = budget12 + 28
>

```