@ 2016-03-08T18:01:20Z <?php
$start = strtotime('20016-02-05');
$end = strtotime('2016-04-05');
$start_m = new DateTime('20016-02-05');
$end_m = new DateTime('2016-04-05');
$start_m->modify('first day of this month');
$end_m->modify('first day of next month');
$interval = DateInterval::createFromDateString('1 month');
$period = new DatePeriod($start_m, $interval, $end_m);
foreach ($period as $dt) {
$date_range_m[]=$dt->format("Y-m");
}
print_r($date_range_m);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.5.0 - 5.5.35 , 5.6.0 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 Array
(
[0] => 2006-02
[1] => 2006-03
[2] => 2006-04
[3] => 2006-05
[4] => 2006-06
[5] => 2006-07
[6] => 2006-08
[7] => 2006-09
[8] => 2006-10
[9] => 2006-11
[10] => 2006-12
[11] => 2007-01
[12] => 2007-02
[13] => 2007-03
[14] => 2007-04
[15] => 2007-05
[16] => 2007-06
[17] => 2007-07
[18] => 2007-08
[19] => 2007-09
[20] => 2007-10
[21] => 2007-11
[22] => 2007-12
[23] => 2008-01
[24] => 2008-02
[25] => 2008-03
[26] => 2008-04
[27] => 2008-05
[28] => 2008-06
[29] => 2008-07
[30] => 2008-08
[31] => 2008-09
[32] => 2008-10
[33] => 2008-11
[34] => 2008-12
[35] => 2009-01
[36] => 2009-02
[37] => 2009-03
[38] => 2009-04
[39] => 2009-05
[40] => 2009-06
[41] => 2009-07
[42] => 2009-08
[43] => 2009-09
[44] => 2009-10
[45] => 2009-11
[46] => 2009-12
[47] => 2010-01
[48] => 2010-02
[49] => 2010-03
[50] => 2010-04
[51] => 2010-05
[52] => 2010-06
[53] => 2010-07
[54] => 2010-08
[55] => 2010-09
[56] => 2010-10
[57] => 2010-11
[58] => 2010-12
[59] => 2011-01
[60] => 2011-02
[61] => 2011-03
[62] => 2011-04
[63] => 2011-05
[64] => 2011-06
[65] => 2011-07
[66] => 2011-08
[67] => 2011-09
[68] => 2011-10
[69] => 2011-11
[70] => 2011-12
[71] => 2012-01
[72] => 2012-02
[73] => 2012-03
[74] => 2012-04
[75] => 2012-05
[76] => 2012-06
[77] => 2012-07
[78] => 2012-08
[79] => 2012-09
[80] => 2012-10
[81] => 2012-11
[82] => 2012-12
[83] => 2013-01
[84] => 2013-02
[85] => 2013-03
[86] => 2013-04
[87] => 2013-05
[88] => 2013-06
[89] => 2013-07
[90] => 2013-08
[91] => 2013-09
[92] => 2013-10
[93] => 2013-11
[94] => 2013-12
[95] => 2014-01
[96] => 2014-02
[97] => 2014-03
[98] => 2014-04
[99] => 2014-05
[100] => 2014-06
[101] => 2014-07
[102] => 2014-08
[103] => 2014-09
[104] => 2014-10
[105] => 2014-11
[106] => 2014-12
[107] => 2015-01
[108] => 2015-02
[109] => 2015-03
[110] => 2015-04
[111] => 2015-05
[112] => 2015-06
[113] => 2015-07
[114] => 2015-08
[115] => 2015-09
[116] => 2015-10
[117] => 2015-11
[118] => 2015-12
[119] => 2016-01
[120] => 2016-02
[121] => 2016-03
[122] => 2016-04
)
Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Array
(
[0] => 2006-02
[1] => 2006-03
[2] => 2006-04
[3] => 2006-05
[4] => 2006-06
[5] => 2006-07
[6] => 2006-08
[7] => 2006-09
[8] => 2006-10
[9] => 2006-11
[10] => 2006-12
[11] => 2007-01
[12] => 2007-02
[13] => 2007-03
[14] => 2007-04
[15] => 2007-05
[16] => 2007-06
[17] => 2007-07
[18] => 2007-08
[19] => 2007-09
[20] => 2007-10
[21] => 2007-11
[22] => 2007-12
[23] => 2008-01
[24] => 2008-02
[25] => 2008-03
[26] => 2008-04
[27] => 2008-05
[28] => 2008-06
[29] => 2008-07
[30] => 2008-08
[31] => 2008-09
[32] => 2008-10
[33] => 2008-11
[34] => 2008-12
[35] => 2009-01
[36] => 2009-02
[37] => 2009-03
[38] => 2009-04
[39] => 2009-05
[40] => 2009-06
[41] => 2009-07
[42] => 2009-08
[43] => 2009-09
[44] => 2009-10
[45] => 2009-11
[46] => 2009-12
[47] => 2010-01
[48] => 2010-02
[49] => 2010-03
[50] => 2010-04
[51] => 2010-05
[52] => 2010-06
[53] => 2010-07
[54] => 2010-08
[55] => 2010-09
[56] => 2010-10
[57] => 2010-11
[58] => 2010-12
[59] => 2011-01
[60] => 2011-02
[61] => 2011-03
[62] => 2011-04
[63] => 2011-05
[64] => 2011-06
[65] => 2011-07
[66] => 2011-08
[67] => 2011-09
[68] => 2011-10
[69] => 2011-11
[70] => 2011-12
[71] => 2012-01
[72] => 2012-02
[73] => 2012-03
[74] => 2012-04
[75] => 2012-05
[76] => 2012-06
[77] => 2012-07
[78] => 2012-08
[79] => 2012-09
[80] => 2012-10
[81] => 2012-11
[82] => 2012-12
[83] => 2013-01
[84] => 2013-02
[85] => 2013-03
[86] => 2013-04
[87] => 2013-05
[88] => 2013-06
[89] => 2013-07
[90] => 2013-08
[91] => 2013-09
[92] => 2013-10
[93] => 2013-11
[94] => 2013-12
[95] => 2014-01
[96] => 2014-02
[97] => 2014-03
[98] => 2014-04
[99] => 2014-05
[100] => 2014-06
[101] => 2014-07
[102] => 2014-08
[103] => 2014-09
[104] => 2014-10
[105] => 2014-11
[106] => 2014-12
[107] => 2015-01
[108] => 2015-02
[109] => 2015-03
[110] => 2015-04
[111] => 2015-05
[112] => 2015-06
[113] => 2015-07
[114] => 2015-08
[115] => 2015-09
[116] => 2015-10
[117] => 2015-11
[118] => 2015-12
[119] => 2016-01
[120] => 2016-02
[121] => 2016-03
[122] => 2016-04
)
preferences:dark mode live preview
232.81 ms | 409 KiB | 258 Q