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

Answer Posted / dheeraj

<?php
$date1=date('Y-m-d');
$date2="2007-09-15";
echo (round($diff=strtotime($date1)-strtotime($date2)))/86400;
?>

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is design pattern? Explain all including singleton pattern?

536


What are the advantages of stored procedures in php?

499


How we load all classes that placed in different directory in one php file , means how to do auto load classes.

504


What are the benefits of using queries?

514


Which is not a php magic constant?

580






How to pass an argument to a function?

553


What is the difference between fopen() and fclose()?

588


What is self in php?

555


How to check curl is enabled or not in PHP

636


How to insert an new array element in array?

536


What is PHP? Who is the father or inventor of PHP?

613


What is mysql_real_escape_string used for?

561


What are the common uses of php?

561


Which is better mysql or sql?

529


What is the meaning of a persistent cookie?

561