PHP How to get two time between the year and month and the interval days between PHP two dates all dates

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.