1 $time 1=Strtotime(' 2014-02-04 ');//automatically 00:00:00 time between two hours of the year and month2 $time 2=Strtotime(' 2015-02-06 '); 3 4 $monarr=Array(); 5 $monarr[] = ' 2014-02 ';//Current month; 6 while( ($time 1=Strtotime(' +1 month ',$time 1)) <=$time 2){ 7 $monarr[] =Date(' Y-m ',$time 1);//get the increment month; 8 } 9 Ten Print_r($monarr);
1<?PHP2 //today and September 9, 2008 How many days difference3 $Date _1=Date("y-m-d"); 4 $Date _2= "2008-10-11"; 5 $d 1=Strtotime($Date _1); 6 $d 2=Strtotime($Date _2); 7 $Days=round(($d 2-$d 1)/3600/24); 8 Echo"Today differs from October 11, 2008".$Days. Days; 9?>
1<?PHP2 functionPrdates ($start,$end){//all dates between two dates3 $dt _start=Strtotime($start); 4 $dt _end=Strtotime($end); 5 while($dt _start<=$dt _end){ 6 Echo Date(' y-m-d ',$dt _start)." \ n "; 7 $dt _start=Strtotime(' +1 Day ',$dt _start); 8 } 9 } TenPrdates (' 2005-02-01 ', ' 2005-02-05 '); One A?>
PHP How to get two time between the year and month and the interval days between PHP two dates all dates