1ヶ月後の日時を取得する

	/**
	 *
	 * 1ヶ月後の日時を取得する
	 * @param integer $month
	 * @param date $start_date
	 * @return timestamp
	 */
	function endOfMonthPeriod($month, $start_date) {
		$ts1 = strtotime(sprintf('%dmonth -1day', $month), $start_date);
		$ts2 = mktime(0, 0, 0, date("m", $start_date) + (int)$month + 1, 0, date("y", $start_date));
		return min($ts1, $ts2);
	}

Leave a Response