public String format(Date date) {
    return format(Timestamp.ofEpochSecond(date.toEpochSecond()));
  }
Make sure the generated list of tokens is valid for formatting datetime objects to strings.
common/src/java/org/apache/hadoop/hive/common/format/datetime/HiveSqlDateTimeFormatter.java