Skip to content

Instantly share code, notes, and snippets.

@johnabela
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnabela/8d7036a358eb3b4a4530 to your computer and use it in GitHub Desktop.
Save johnabela/8d7036a358eb3b4a4530 to your computer and use it in GitHub Desktop.
How many days between two unix time stamps
//
//
///////////////////////////////////////////////////////////////////////
// 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