Last active
August 29, 2015 14:09
-
-
Save johnabela/8d7036a358eb3b4a4530 to your computer and use it in GitHub Desktop.
How many days between two unix time stamps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
/////////////////////////////////////////////////////////////////////// | |
// howManyDaysBetweenTwoDays() | |
// | |
// - Description: | |
// How many days between two unix time stamps | |
// 86400 is derived from: | |
// 60 (seconds) multiplied by 60 (minutes) multiplied by 24 (hours) | |
// | |
// - Usage: | |
// $days = howManyDaysBetweenTwoDays(); | |
// | |
// - Variables: | |
// $start = first unixtimestamp | |
// $end = second unixtimestamp | |
// | |
// - Author: | |
// John B. Abela <abela@4cm.com> | |
// | |
// - History: | |
// 2/10/2014 4:15 AM - File Created | |
/////////////////////////////////////////////////////////////////////// | |
function howManyDaysBetweenTwoDays($start,$end) { | |
$total_days = floor(($end-$start)/86400); | |
return ($total_days < 1 ? 0 : $total_days); | |
} | |
// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment