code: static public String getFormattedDateTime(long dt, String format, TimeZone tz, String country, long tolerance)
      {
          String ret = "";
          SimpleDateFormat df = null;
  
          try
          {
              if(dt > tolerance)
              {
                  df = formatPool.getFormat(format);
                  df.setTimeZone(tz);
                  DateUtilities.setCalendarData(df.getCalendar(), DateUtilities.getLocale(country));
                  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, timezone and country.
  @param dt The date to be formatted
  @param format The format to use to display the date
  @param tz The timezone associated with the date
  @param country The country associated with the date
  @param tolerance The tolerance for the date to be formatted
  @return The given date formatted using the given format, timezone and country