src/com/mlhsoftware/commandline/model/DateUtil.java
public final static String friendlyTime( Date timestamp )
  {
    String retVal = "";

    Date currentTime = new Date();
    long diffInSeconds = ( timestamp.getTime() - currentTime.getTime() ) / 1000;

    long diff[] = new long[] { 0, 0, 0, 0 };
    /* sec */
    diff[3] = ( diffInSeconds >= 60 ? diffInSeconds % 60 : diffInSeconds );
    /* min */
    diff[2] = ( diffInSeconds = ( diffInSeconds / 60 ) ) >= 60 ? diffInSeconds % 60 : diffInSeconds;
    /* hours */
    diff[1] = ( diffInSeconds = ( diffInSeconds / 60 ) ) >= 24 ? diffInSeconds % 24 : diffInSeconds;
    /* days */
    diff[0] = ( diffInSeconds = ( diffInSeconds / 24 ) );

    if ( diffInSeconds < 10 )
    {
      retVal = "now";
    }
    else if ( diffInSeconds < 60 )
    {
      retVal = diff[3] + "secounds ago";
    }
    else if ( diffInSeconds < (60 * 60) )
    {
      retVal = diff[2] + "minutes ago";
    }
    else if ( diffInSeconds < ( 60 * 60 * 12 ) )
    {
      retVal = diff[1] + "hours ago";
    }
    else
    {
      retVal = formatTimestamp( timestamp, "MM/dd/yyyy HH:mm" );
    }
    return retVal;
  }
// If more than 12 hours the social aspect has long passed and no longer matters, so will just show the normal timestamp.
If more than 12 hours the social aspect has long passed and no longer matters, so will just show the normal timestamp.
If more than 12 hours the social aspect has long passed and no longer matters so will just show the normal timestamp .
public final static String friendlyTime( Date timestamp )
  {
    String retVal = "";
    Date currentTime = new Date();
    long diffInSeconds = ( timestamp.getTime() - currentTime.getTime() ) / 1000;
    long diff[] = new long[] { 0, 0, 0, 0 };
    /* sec */
    diff[3] = ( diffInSeconds >= 60 ? diffInSeconds % 60 : diffInSeconds );
    /* min */
    diff[2] = ( diffInSeconds = ( diffInSeconds / 60 ) ) >= 60 ? diffInSeconds % 60 : diffInSeconds;
    /* hours */
    diff[1] = ( diffInSeconds = ( diffInSeconds / 60 ) ) >= 24 ? diffInSeconds % 24 : diffInSeconds;
    /* days */
    diff[0] = ( diffInSeconds = ( diffInSeconds / 24 ) );
    if ( diffInSeconds < 10 )
    {
      retVal = "now";
    }
    else if ( diffInSeconds < 60 )
    {
      retVal = diff[3] + "secounds ago";
    }
    else if ( diffInSeconds < (60 * 60) )
    {
      retVal = diff[2] + "minutes ago";
    }
    else if ( diffInSeconds < ( 60 * 60 * 12 ) )
    {
      retVal = diff[1] + "hours ago";
    }
    else
    {
      retVal = formatTimestamp( timestamp, "MM/dd/yyyy HH:mm" );
    }
    return retVal;
  }
public final static String friendlyTime ( Date timestamp ) { String retVal = "" ; Date currentTime = new Date ( ) ; long diffInSeconds = ( timestamp . getTime ( ) - currentTime . getTime ( ) ) / 1000 ; long diff [ ] = new long [ ] { 0 , 0 , 0 , 0 } ; /* sec */ diff [ 3 ] = ( diffInSeconds >= 60 ? diffInSeconds % 60 : diffInSeconds ) ; /* min */ diff [ 2 ] = ( diffInSeconds = ( diffInSeconds / 60 ) ) >= 60 ? diffInSeconds % 60 : diffInSeconds ; /* hours */ diff [ 1 ] = ( diffInSeconds = ( diffInSeconds / 60 ) ) >= 24 ? diffInSeconds % 24 : diffInSeconds ; /* days */ diff [ 0 ] = ( diffInSeconds = ( diffInSeconds / 24 ) ) ; if ( diffInSeconds < 10 ) { retVal = "now" ; } else if ( diffInSeconds < 60 ) { retVal = diff [ 3 ] + "secounds ago" ; } else if ( diffInSeconds < ( 60 * 60 ) ) { retVal = diff [ 2 ] + "minutes ago" ; } else if ( diffInSeconds < ( 60 * 60 * 12 ) ) { retVal = diff [ 1 ] + "hours ago" ; } else { retVal = formatTimestamp ( timestamp , "MM/dd/yyyy HH:mm" ) ; } return retVal ; }
If more than 12 hours the social aspect has long passed and no longer matters, so will just show the normal timestamp.
If more than 12 hours the social aspect has long passed and no longer matters so will just show the normal timestamp .