Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL
Created August 23, 2016 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SiR-DanieL/dc079ed5058cf397f9dad50d7759ca7e to your computer and use it in GitHub Desktop.
Save SiR-DanieL/dc079ed5058cf397f9dad50d7759ca7e to your computer and use it in GitHub Desktop.
// Difference for between now and a date in the future
$future_timestamp = strtotime( '1st January 2020' );
$difference = human_time_diff( current_time( 'timestamp' ), $future_timestamp );
// Difference between a date in the past and now
$past_timestamp = strtotime( '1st January 2016' );
$difference = human_time_diff( $past_timestamp, current_time( 'timestamp' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment