1$time = strtotime("2010.12.11");
2$final = date("Y-m-d", strtotime("+1 month", $time));
1echo Date("Y-m-d", strtotime("2013-01-01 +1 Month -1 Day"));// 2013-01-31
2
3echo Date("Y-m-d", strtotime("2013-01-31 +1 Month -3 Day")); // 2013-02-28
4
5echo Date("Y-m-d", strtotime("2013-01-31 +2 Month")); // 2013-03-31
6
7echo Date("Y-m-d", strtotime("2013-01-31 +3 Month -1 Day")); // 2013-04-30
8
9echo Date("Y-m-d", strtotime("2013-12-31 -1 Month -1 Day")); // 2013-11-30
10
11echo Date("Y-m-d", strtotime("2013-12-31 -2 Month")); // 2013-10-31
12
13echo Date("Y-m-d", strtotime("2013-12-31 -3 Month")); // 2013-10-01
14
15echo Date("Y-m-d", strtotime("2013-12-31 -3 Month -1 Day")); // 2013-09-30
1<?php
2$months = n; // Here n = …..-2,-1,0,1,2, …..(months to add or subtract)
3$years = n; // Here n = …..-2,-1,0,1,2, …..(years to add or subtract)
4echo date('Y-m-28', mktime(0, 0, 0, date('m')+$months, 1, date('Y') + $years));
5?>