code: static public String getFormattedDateTime(long dt, String format, 
          boolean useTZ, long tolerance)
      {
          String ret = "";
          SimpleDateFormat df = null;
  
          try
          {
              if(dt > tolerance)
              {
                  df = formatPool.getFormat(format);
                  if(useTZ)
                      df.setTimeZone(DateUtilities.getCurrentTimeZone());
                  else
                      df.setTimeZone(TimeZone.getTimeZone("GMT"));
                  ret = df.format(new Date(dt));
              }
          }
          catch(Exception e)
          {
          }
  
          if(df != null)
              formatPool.release(df);
  
          return ret;
      }
docs: Returns the given date formatted using the given format.
  @param dt The date to be formatted
  @param format The format to use to display the date
  @param useTZ <CODE>true</CODE> if the date should be converted using the current timezone
  @param tolerance The tolerance for the date to be formatted
  @return The given date formatted using the given format