I see that all of the good date/time functions are PHP5 only, which sort of makes this hard. I need to generate a list of all pay-period-ending dates starting with 52 weeks back and going to one pay period in the future, with bi-weekly periods.
So, suppose the next pay period ending is June 26, 2010 and today is June 23, 2010, I'd want a list starting with (approximately) June 26, 2009 and ending with June 26, 2010.
If the date is the same day as the pay period ending, I want to include the next one: If the next pay period ending is June 26, 2010 and today is June 26, 2010, I'd want a list starting with (approximately) June 26, 2009 and ending with July 10, 2010.
So, here'd be the call:
>>> get_pay_period_ending_dates($timeInSecondsFromEpoch);
[
$date52weeksBeforeTheNextPayPeriodEnding,
$date50weeksBeforeTheNextPayPeriodEnding,
...
$nextPayPeriodEnding
]
Obviously, that's an approximation of the dates I want. Preferably, in seconds since epoch.
What's the best way to do this, using only tools available in PHP 4.3?