So, uh, ok. This might get mathematical, so hope you brought your scientific calculator with you ;)
This is my problem:
Given an initial date (timestamp), time period period (seconds) and today's date (timestamp), I need to find the nearest date which coincides with the period*n plus the original/initial date.
So far, I got some stuff working nicely, such as the amount of "periods" between the initial and final(today's) date, which would be "2" in the demo above:
$initial=strtotime('2 April 1991');
$time=time();
$period=strtotime('+10 years',0);
$periods=round(($time-$initial)/$period);
The next thing I did was:
$range=$periods*$period;
And finally:
echo date('d M Y',$initial+$range);
Which wrote '03 April 2011'. How did it get to 3? (I suspect it's a leap year issue?) You know that feeling when you're missing something small? I'm feeling it all over me right now....