How can we know the number of days between two given dates
using PHP?
How can we know the number of days between two given dates
using MySQL?

Answer Posted / indira majumder

<?php
$date1 = date('y-m-d');
$date2 = '2007-12-7';
$days = (strtotime($date2)-strtotime($date1))/(60*60*24);
echo "Number of Days since '2007-12-7': $days";

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is nginx and what is it used for?

508


How to get number of elements in an array?

527


What is zend studio for?

532


Which are the best start and end tags to use?

570


What is csrf token and how it works?

515






List the different types of print functions available in php?

535


How we can get the number of elements in an array?

8401


What is the use of "enctype" attribute in a html form?

519


Which function Returns the time of sunrise for a given day / location in PHP.

579


What does csrf token mean?

502


What are the advantages of indexes?

494


What are the differences between mysqli_connect and mysqli_pconnect?

528


Why do we use htaccess

626


When is a conditional statement ended with endif?

495


Can php use gettext?

552