Apply for Zend Framework Certification Training

Corephp




Here we are Discussing about  finding Difference Between 
  Two dates

  $date1 = "2014-05-27 01:00:00";
  $date2 = "2014-05-28 02:00:00";
  $timestamp1 = strtotime($date1);
  $timestamp2 = strtotime($date2);
  echo "Difference between two dates is " . 
  $hour = abs($timestamp2 - $timestamp1)/(60*60) . " hour(s)";

If you want to calculate the difference from Todays date
  Then you have to use
  $date1 = "2014-05-27 01:00:00";
  $date2 = date('Y-m-d H:i:s');
  $timestamp1 = strtotime($date1);
  $timestamp2 = strtotime($date2);
  $hour = abs($timestamp2 - $timestamp1)/(60*60*24); 
  // will reflect Days                                    

< How to get response data from json to angularjs How to display selected value from database in php >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top