public static String relativeToAbsolute(String relative, Date now) throws SemanticException { if (RELDATE_VALIDATOR.matcher(relative).matches()) { return ABSDATE_PARSER.get().format(resolveRelativeDate(relative, now)); } else { return relative; } }
public static Date resolveAbsoluteDate(String str) throws SemanticException { try { return ABSDATE_PARSER.get().parse(getAbsDateFormatString(str)); } catch (ParseException e) { log.error("Invalid date format. expected only {} date provided:{}", ABSDATE_FMT, str, e); throw new SemanticException(e, ErrorMsg.WRONG_TIME_RANGE_FORMAT, ABSDATE_FMT, str); } }
public static String formatDate(Date dt) { return ABSDATE_PARSER.get().format(dt); }