public static boolean parseDate(final String text, final Date result) {
    Objects.requireNonNull(text);
    Objects.requireNonNull(result);

    try {
      Date date = DATE_CACHE.get(text);
      result.setTimeInMillis(date.toEpochMilli());
      return true;
    } catch (Exception e) {
      return false;
    }
  }
Obtains an instance of Date from a text string such as 2021-02-21. The
{@code result} is not modified if parsing of the {@code text} fails.

@param text the text to parse
@param result the {@code Date} to load the results into
@return True if parsing was successful; false otherwise.
@throws NullPointerException if {@code text} or {@code result} is null
common/src/java/org/apache/hive/common/util/DateParser.java