presto-teradata-functions/src/main/java/io/prestosql/teradata/functions/dateformat/DateFormatParser.java/DateFormatParser/createDateTimeFormatter
class DateFormatParser:    public static DateTimeFormatter createDateTimeFormatter(String format)
    {
        DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
        for (Token token : tokenize(format)) {
            switch (token.getType()) {
                case DateFormat.TEXT:
                    builder.appendLiteral(token.getText());
                    break;
                case DateFormat.DD:
                    builder.appendDayOfMonth(2);
                    break;
                case DateFormat.HH24:
                    builder.appendHourOfDay(2);
                    break;
                case DateFormat.HH:
                    builder.appendHourOfHalfday(2);
                    break;
                case DateFormat.MI:
                    builder.appendMinuteOfHour(2);
                    break;
                case DateFormat.MM:
                    builder.appendMonthOfYear(2);
                    break;
                case DateFormat.SS:
                    builder.appendSecondOfMinute(2);
                    break;
                case DateFormat.YY:
                    builder.appendTwoDigitYear(2050);
                    break;
                case DateFormat.YYYY:
                    builder.appendYear(4, 4);
                    break;
                case DateFormat.UNRECOGNIZED:
                default:
                    throw new PrestoException(
                            StandardErrorCode.INVALID_FUNCTION_ARGUMENT,
                            format("Failed to tokenize string [%s] at offset [%d]", token.getText(), token.getCharPositionInLine()));
            }
        }

        try {
            return builder.toFormatter();
        }
        catch (UnsupportedOperationException e) {
            throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e);
        }
    }