code: public static String getTimeAgo(long time) {
          // TODO: use DateUtils methods instead
          if (time < 1000000000000L) {
              // if timestamp given in seconds, convert to millis
              time *= 1000;
          }
  
          long now = System.currentTimeMillis();
          if (time > now || time <= 0) {
              return null;
          }
  
          final long diff = now - time;
          if (diff < MINUTE) {
              return "just now";
          } else if (diff < 2 * MINUTE) {
              return "a minute ago";
          } else if (diff < 50 * MINUTE) {
              return diff / MINUTE + " minutes ago";
          } else if (diff < 90 * MINUTE) {
              return "an hour ago";
          } else if (diff < 24 * HOUR) {
              return diff / HOUR + " hours ago";
          } else if (diff < 48 * HOUR) {
              return "yesterday";
          } else {
              return diff / DAY + " days ago";
          }
      }
docs: <p>
  Get a timestamp in a an *ago format
  e.g.; "just now", "a minute ago", "5 minutes ago", "10 hours ago", "2 days ago", etc...
  </p>
  
  @param time      the time to format
  @return          the formated time