Skip to content

Instantly share code, notes, and snippets.

@johnpbloch
Created April 25, 2016 22:51
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 johnpbloch/e67cdd88554349df2c7c14fe43405268 to your computer and use it in GitHub Desktop.
Save johnpbloch/e67cdd88554349df2c7c14fe43405268 to your computer and use it in GitHub Desktop.
<?php
/** @var int $start The start timestamp */
/** @var int $end The end timestamp */
$days = ceil( abs( $end - $start ) / DAY_IN_SECONDS );
if ( date( 'Ymd', $start ) !== date( 'Ymd', $end ) ) {
$days += 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment