Exemplo n.º 1
0
 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;
   }
 }
Exemplo n.º 2
0
 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);
   }
 }
Exemplo n.º 3
0
 public static String formatDate(Date dt) {
   return ABSDATE_PARSER.get().format(dt);
 }