Quick Search:
 
 PHP Code: Count days between dates Jump to:  
Category: >> PHP Code >> Count days between dates  

<< lastnext >>

Snippet Name: Count days between dates

Description: Find how many days there are between two given dates.

Also see:
» Convert UK Dates To mySQL Format Dates
» Delete files older than 'X'
» String to Date
» Month, Day, Year dropdown boxes
» Calculate date of Easter Sunday
» Define a schedule of holidays
» Calendar for any month any year
» Add and Subtract dates
» Basic PHP Calendar
» Convert Standard time to 24-hour time ...
» What Season Is It?
» Delete by date
» Days in month #2
» Days in month one
» Find days between dates one
» Build Date Select Boxes

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?PHP
 
// First Date: 1 January 2005
// Second Date: 27 January 2005
 
$first_date = MKTIME(12,0,0,1,1,2005);
$second_date = MKTIME(12,0,0,1,27,2005);
 
$offset = $second_date-$first_date;
 
ECHO FLOOR($offset/60/60/24) . " days";
 
// This will display: 26 days. 
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org