/** * Returns the timestamp for the next occurance of [month]. * * @param timestamp * @param int the month of year * @return timestamp */ public static function nextMonth($ts = null, $month = sfTime::JANUARY) { // default to now if ($ts === null) { $ts = sfDateTimeToolkit::now(); } // get offsets from january $offset1 = date('m', $ts); $offset2 = $month; // adjust if date wraps into next year $offset2 += $offset2 > $offset1 ? 0 : 12; return sfTime::addMonth($ts, $offset2 - $offset1); }