Handle some odd dates from family tree maker.

@param dateString the input string
@return the stripped string
496681
private String handleFTMBizzareDateFormat(final String dateString) {
        approximation = DateParser.Approximation.BETWEEN;
        String string = stripPrefix(dateString, "(").trim();
        string = stripSuffix(string, ")").trim();
        if ("BIC".equals(string)) {
            // BIC refers to LDS status "born in the covenant". Such a date can
            // be treated as a plain string with no approximation semantics.
            return "";
        }
        if (startsWithIgnoreCase(string, ABT)) {
            string = stripPrefix(string, ABT).trim();
            approximation = DateParser.Approximation.ABOUT;
        }
        if (startsWithIgnoreCase(string, AFT)) {
            string = stripPrefix(string, AFT).trim();
            approximation = DateParser.Approximation.AFTER;
        }
        if (startsWithIgnoreCase(string, BEF)) {
            string = stripPrefix(string, BEF).trim();
            approximation = DateParser.Approximation.BEFORE;
        }
        if (startsWithIgnoreCase(string, FROM)) {
            string = stripPrefix(string, FROM).trim();
        }
        string = truncateAt(string, "-");
        string = truncateAt(string, " TO ");
        if (string.length() <= 2) {
            // Probably like 10-11 Nov 2017
            string = stripPrefix(dateString, "(").trim();
            string = stripSuffix(string, ")").trim();
            string = removeBeginningAt(string, "-");
            string = removeBeginningAt(string, " TO ");
        }
        return string;
    }
518271
public static String getStringFromISODateString(String dateISOString) {
        Date date;
        String formattedDate;
        DateFormat formatter = getFormatter();
        try {
            date = formatter.parse(dateISOString);
            formattedDate = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(date);
        } catch (ParseException e) {
            logger.log(Level.WARNING, e.getMessage(), e);
            formattedDate = dateISOString;
        }
        return formattedDate;
    }
1159327
private static void convertDateString(String str) {
        try {
            Date date = Utils.dateFromString(str);
            display("Date to millis: " + date.getTime());
        } catch (Exception e) {
        }
    }
677930
public static Date iso8601ToDate(final String dateString) 
        throws ParseException
        {
        final SimpleDateFormat df = 
            new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
        
        // We need to manually parse ISO 8601s ":".
        final String str = StringUtils.substringBeforeLast(dateString, ":") +
            StringUtils.substringAfterLast(dateString, ":");
        return df.parse(str);
        }
137251
private static String convertDateElementToString(Date currentDate, SimpleDateFormat dateFormat) {
        return currentDate.getTime() != 0 ? dateFormat.format(currentDate.getTime()) : "";
    }
417161
public static String toDateString(java.util.Date date) {
		if (date == null)
			return "";
		Calendar calendar = Calendar.getInstance();

		calendar.setTime(date);
		int month = calendar.get(Calendar.MONTH) + 1;
		int day = calendar.get(Calendar.DAY_OF_MONTH);
		int year = calendar.get(Calendar.YEAR);
		String monthStr;
		String dayStr;
		String yearStr;

		if (month < 10) {
			monthStr = "0" + month;
		} else {
			monthStr = "" + month;
		}
		if (day < 10) {
			dayStr = "0" + day;
		} else {
			dayStr = "" + day;
		}
		yearStr = "" + year;
		return monthStr + "/" + dayStr + "/" + yearStr;
	}
1075328
protected String parseDateToString(Date date, Context context, Arguments args)
    {
        final DateFormat dateFormat = parseFormatter(context, args);
        dateFormat.setTimeZone(context.get(Contexts.TIMEZONE));
        return dateFormat.format(date);
    }
827279
public static Date stringToDate(String dateString) {
        if (!"".equals(dateString) && dateString != null) {
            // ISO_DATE_FORMAT = "yyyyMMdd";
            if (dateString.trim().length() == 8) {
                return stringToDate(dateString, ISO_DATE_FORMAT, LENIENT_DATE);
            } else if (dateString.trim().length() == 10) {
                // ISO_EXPANDED_DATE_FORMAT = "yyyy-MM-dd";
                return stringToDate(dateString, ISO_EXPANDED_DATE_FORMAT,
                        LENIENT_DATE);
            } else if (dateString.trim().length() == 19) {
                // DATETIME_PATTERN = "yyyy-MM-dd hh:mm:ss";
                return stringToDate(dateString, DATETIME_PATTERN, LENIENT_DATE);
            } else if (dateString.trim().length() == 11) {
                // CHINESE_EXPANDED_DATE_FORMAT = "yyyy年MM月dd日";
                return stringToDate(dateString, CHINESE_EXPANDED_DATE_FORMAT,
                        LENIENT_DATE);
            }
        }
        return null;
    }
570099
public String convertDateToString(final Date date) {
        if (date == null) {
            return null;
        }
        return dateFormat.get().format(date);
    }
1226849
public String dateToString(D date) {
    try {
      return String.format(DATE_PATTERN,
          (Integer) PropertyUtils.getProperty(date, "year"),
          (Integer) PropertyUtils.getProperty(date, "month"),
          (Integer) PropertyUtils.getProperty(date, "day"));
    } catch (IllegalAccessException e) {
      throw new IllegalStateException("Could not access class.", e);
    } catch (InvocationTargetException e) {
      throw new IllegalStateException("Could not get field.", e);
    } catch (NoSuchMethodException e) {
      throw new IllegalStateException("Could not get field.", e);
    }
  }
1024253
public Object stringToBinary(String tempString) throws Exception
    {
        java.util.Date dateOld = new java.util.Date((long)this.getValue());   // Save current time
        return DateConverter.stringToBinary(tempString, dateOld, DBConstants.TIME_ONLY_FORMAT);
    }
1358325
public static String changeFormatAndTimeZoneToOffsetDateTime(
            String dateFormat, String dateString) {
        return getOffsetDateTime(changeTimestampToLong(dateFormat, dateString))
                .toString();
    }
907739
public String dateToString(Date date)
    {
        if (date == null)
            return "";
        try {
            return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG).format(date);
        } catch (Exception ex) {
        }
        return "";
    }
337748
public static Instant parseIso8601Date(String dateString) {
        // For EC2 Spot Fleet.
        if (dateString.endsWith("+0000")) {
            dateString = dateString
                    .substring(0, dateString.length() - 5)
                    .concat("Z");
        }

        try {
            return parseInstant(dateString, ISO_INSTANT);
        } catch (DateTimeParseException e) {
            return parseInstant(dateString, ALTERNATE_ISO_8601_DATE_FORMAT);
        }
    }
911470
private static String cleanDate(final String dateString) {
        if (dateString == null) {
            return dateString;
        }

        String retValue = dateString;
        retValue = THURSDAY_DATE_RE.matcher(retValue).replaceAll("Thu");
        retValue = TUESDAY_DATE_RE.matcher(retValue).replaceAll("Tue");

        return retValue;
    }
87288
@Override
  public final String toDateString(final Date pDate,
    final Map<String, Object> pAddParam) throws Exception {
    return this.dateFormat.format(pDate);
  }
1344205
private static Date parse(String dateStr, DateFormat dateFormat) {
		try {
			return dateFormat.parse(dateStr);
		} catch (Exception e) {
			String pattern;
			if (dateFormat instanceof SimpleDateFormat) {
				pattern = ((SimpleDateFormat) dateFormat).toPattern();
			} else {
				pattern = dateFormat.toString();
			}
			throw new DateException(StrUtil.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
		}
	}