Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get dates between two given dates in PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 111
    Comment on it

    Hello Readers's if you want to get a recursive set of dates between two given dates, For example 10-12-2105 to 19-12-2015 there are 9 days all will have different dates. By using PHP you can get this as using the code below:-

    $startTime = strtotime('2010-05-01'); 
    $endTime = strtotime('2010-05-10'); 
    
    // Loop between timestamps, 1 day at a time 
    do {
       $startTime = strtotime('+1 day',$startTime); 
       echo $startTime;
    } while ($startTime < $endTime);
    

    Now it will print the dates between two dates by individual days.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: