import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Locale;

public class Reproducer {

    private static final ZonedDateTime expectedTime = ZonedDateTime.of(2019, 3, 12, 17, 51, 40, 123000000, ZoneId.of("Etc/UTC"));
    private static final String timeString = "2019-03-12T17:51:40.123UTC+00:00";

    private static final String format_zxxx = "yyyy-MM-dd'T'HH:mm:ss.SSSzxxx";
    private static final String format_zxxxxx = "yyyy-MM-dd'T'HH:mm:ss.SSSzxxxxx";

    public static void main(String[] args) {
        DateTimeFormatter formatter_zxxx = DateTimeFormatter.ofPattern(format_zxxx);
        try {
            System.out.println(ZonedDateTime.parse(timeString, formatter_zxxx));
        } catch (DateTimeParseException e) {
            System.out.println("Failed to parse with zxxx: " + e.getMessage());
            e.printStackTrace();
        }

        DateTimeFormatter formatter_zxxxxx = DateTimeFormatter.ofPattern(format_zxxxxx);
        try {
            System.out.println(ZonedDateTime.parse(timeString, formatter_zxxxxx));
        } catch (DateTimeParseException e) {
            System.out.println("Failed to parse with zxxxxx: " + e.getMessage());
            e.printStackTrace();
        }

        DateTimeFormatter formatter_zxxx_localeUS = DateTimeFormatter.ofPattern(format_zxxx, Locale.US);
        try {
            System.out.println(ZonedDateTime.parse(timeString, formatter_zxxx_localeUS));
        } catch (DateTimeParseException e) {
            System.out.println("Failed to parse with zxxx with Locale.US: " + e.getMessage());
            e.printStackTrace();
        }

        DateTimeFormatter formatter_zxxxxx_localeUS = DateTimeFormatter.ofPattern(format_zxxxxx, Locale.US);
        try {
            System.out.println(ZonedDateTime.parse(timeString, formatter_zxxxxx_localeUS));
        } catch (DateTimeParseException e) {
            System.out.println("Failed to parse with zxxxxx with Locale.US: " + e.getMessage());
            e.printStackTrace();
        }
    }

}