Show different time stamp based on time

Check out human_time_diff():

if ( DAY_IN_SECONDS < ( $time = current_time( 'timestamp' ) ) - ( $time_post = get_the_time( 'U' ) ) )
    echo human_time_diff( $time_post, $time ) . ' ago';
else
    the_time( 'F j, Y at g:i a' );

DAY_IN_SECONDS is a handy “helper” constant in WordPress, along with:

  • MINUTE_IN_SECONDS
  • HOUR_IN_SECONDS
  • WEEK_IN_SECONDS
  • YEAR_IN_SECONDS