Ejemplo n.º 1
0
 public String toString(Object object) throws DataConvertException {
   try {
     return UtcTimeOnlyConverter.convert((Date) object, false);
   } catch (Exception e) {
     throw new DataConvertException(e.getMessage());
   }
 }
Ejemplo n.º 2
0
  public Object fromString(String value) throws DataConvertException {
    try {
      Date date = UtcTimeOnlyConverter.convert(value);

      // adjust to today
      Calendar today, adjust;
      today = Calendar.getInstance();
      today.setTime(new Date());
      adjust = Calendar.getInstance();
      adjust.setTime(date);
      adjust.set(Calendar.YEAR, today.get(Calendar.YEAR));
      adjust.set(Calendar.MONTH, today.get(Calendar.MONTH));
      adjust.set(Calendar.DATE, today.get(Calendar.DATE));

      return adjust.getTime();
    } catch (FieldConvertError e) {
      throw new DataConvertException(e.getMessage());
    }
  }