Source:
public static Function<String, DateTime> createTimestampParser( final String format ) { if (format.equalsIgnoreCase("auto")) { final DateTimeFormatter parser = createAutoParser(); return (String input) -> { Preconditions.checkArgument(input != null && !input.isEmpty(), "null timestamp"); for (int i = 0; i < input.length(); i++) { if (input.charAt(i) < '0' || input.charAt(i) > '9') { input = ParserUtils.stripQuotes(input); int lastIndex = input.lastIndexOf(' '); DateTimeZone timeZoneFromString = ParserUtils.getDateTimeZone(input.substring(lastIndex + 1)); if (lastIndex > 0 && timeZoneFromString != null) { input = input.substring(0, lastIndex); } return new DateTime( parser.parseDateTime(input), timeZoneFromString == null ? DateTimeZone.UTC : timeZoneFromString ); } } return DateTimes.utc(Long.parseLong(input)); }; } else if (format.equalsIgnoreCase("iso")) { return input -> { Preconditions.checkArgument(input != null && !input.isEmpty(), "null timestamp"); return DateTimes.of(ParserUtils.stripQuotes(input)); }; } else if (format.equalsIgnoreCase("posix") || format.equalsIgnoreCase("millis") || format.equalsIgnoreCase("nano")) { final Function<Number, DateTime> numericFun = createNumericTimestampParser(format); return input -> { Preconditions.checkArgument(input != null && !input.isEmpty(), "null timestamp"); return numericFun.apply(Long.parseLong(ParserUtils.stripQuotes(input))); }; } else if (format.equalsIgnoreCase("ruby")) { final Function<Number, DateTime> numericFun = createNumericTimestampParser(format); return input -> { Preconditions.checkArgument(input != null && !input.isEmpty(), "null timestamp"); return numericFun.apply(Double.parseDouble(ParserUtils.stripQuotes(input))); }; } else { try { final DateTimeFormatter formatter = DateTimeFormat.forPattern(format); return input -> { Preconditions.checkArgument(input != null && !input.isEmpty(), "null timestamp"); return formatter.parseDateTime(ParserUtils.stripQuotes(input)); }; } catch (Exception e) { throw new IAE(e, "Unable to parse timestamps with format [%s]", format); } } }

Target:
public static Function<String, DateTime> createTimestampParser( final String format ) { if (format.equalsIgnoreCase("auto")) { final DateTimeFormatter parser = createAutoParser(); return (String input) -> { Preconditions.checkArgument(!Strings.isNullOrEmpty(input), "null timestamp"); for (int i = 0; i < input.length(); i++) { if (input.charAt(i) < '0' || input.charAt(i) > '9') { input = ParserUtils.stripQuotes(input); int lastIndex = input.lastIndexOf(' '); DateTimeZone timeZone = DateTimeZone.UTC; if (lastIndex > 0) { DateTimeZone timeZoneFromString = ParserUtils.getDateTimeZone(input.substring(lastIndex + 1)); if (timeZoneFromString != null) { timeZone = timeZoneFromString; input = input.substring(0, lastIndex); } } return new DateTime(parser.parseDateTime(input), timeZone); } } return DateTimes.utc(Long.parseLong(input)); }; } else if (format.equalsIgnoreCase("iso")) { return input -> { Preconditions.checkArgument(!Strings.isNullOrEmpty(input), "null timestamp"); return DateTimes.of(ParserUtils.stripQuotes(input)); }; } else if (format.equalsIgnoreCase("posix") || format.equalsIgnoreCase("millis") || format.equalsIgnoreCase("nano")) { final Function<Number, DateTime> numericFun = createNumericTimestampParser(format); return input -> { Preconditions.checkArgument(!Strings.isNullOrEmpty(input), "null timestamp"); return numericFun.apply(Long.parseLong(ParserUtils.stripQuotes(input))); }; } else if (format.equalsIgnoreCase("ruby")) { final Function<Number, DateTime> numericFun = createNumericTimestampParser(format); return input -> { Preconditions.checkArgument(!Strings.isNullOrEmpty(input), "null timestamp"); return numericFun.apply(Double.parseDouble(ParserUtils.stripQuotes(input))); }; } else { try { final DateTimeFormatter formatter = DateTimeFormat.forPattern(format); return input -> { Preconditions.checkArgument(!Strings.isNullOrEmpty(input), "null timestamp"); return formatter.parseDateTime(ParserUtils.stripQuotes(input)); }; } catch (Exception e) { throw new IAE(e, "Unable to parse timestamps with format [%s]", format); } } }