Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to calculate number of days between two given date's in PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 99
    Comment on it

    Hello Reader's! If you need to calculate the number of hours or days between two given dates then PHP offers you a lot of ways. But you can perform this task by the following way: Lets see the example below:-

    //Calculate number of hours between pass and now
    $dayinpass = "2015-01-23 08:11:62";
    $today = time();
    $dayinpass= strtotime($dayinpass);
    echo round(abs($today-$dayinpass)/60/60); 
    

    // here you will get the number of hours between given date and now. Similarly you can get the days and even months also.

 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: