Skip to content

Instantly share code, notes, and snippets.

@brunoalvarenga
Forked from SirDarcanos/functions.php
Created October 7, 2016 12:23
Show Gist options
  • Save brunoalvarenga/7729bb3ed29f8665b02386b9a56669f8 to your computer and use it in GitHub Desktop.
Save brunoalvarenga/7729bb3ed29f8665b02386b9a56669f8 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