Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How can we find the number of days between given two dates on php 5.3 and above

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.72k
    Comment on it

    Hi if you are using php version 5.3 or greater then some functions are really very quick to write and use.
    In this blog I am calculating the days between your given two dates.

    This is by far the most accurate way of calculating the difference:
    This is really a quick and easy method than we have to user earlier

    for ex $data1 is you first date and @date2 is second

    $date1 = new DateTime("2015-07-07");
    $date2 = new DateTime("2014-07-09");
    
    $date_difference = $date2->diff($date1)->format("%a");
    

    and you can see by writing

    echo $date_difference;
    

 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: