public Timestamp parseTimestamp(final String text) {
    if (supportMillisEpoch) {
      try {
        // support for milliseconds that include nanoseconds as well
        // example: "1420509274123.456789"
        final long millis = new BigDecimal(text).setScale(0, RoundingMode.DOWN)
            .longValueExact();
        return Timestamp.ofEpochMilli(millis);
      } catch (NumberFormatException e) {
        LOG.debug("Could not format millis: {}", text);
      }
    }
    for (DateTimeFormatter formatter : this.dtFormatters) {
      try {
        final TemporalAccessor parsed = formatter.parse(text);
        final Instant inst = Instant.from(wrap(parsed));
        return Timestamp.ofEpochMilli(inst.toEpochMilli());
      } catch (DateTimeParseException dtpe) {
        LOG.debug("Could not parse timestamp text: {}", text);
      }
    }

    try {
      return Timestamp.valueOf(text);
    } catch (IllegalArgumentException e) {
      return null;
    }

  }
Parse the input string and return a timestamp value.

@param text The timestamp text
@return A timestamp based on the text provided
@throws IllegalArgumentException if input text cannot be parsed into
          timestamp
common/src/java/org/apache/hive/common/util/TimestampParser.java