import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Locale;

class Main {
    public static void main(String[] args) {
        DateTimeFormatter dtf = new DateTimeFormatterBuilder()
                .append(DateTimeFormatter.ISO_LOCAL_DATE)
                .appendLiteral(' ')
                .append(DateTimeFormatter.ISO_LOCAL_TIME)
                .toFormatter(Locale.ENGLISH);

        String strDateTime = "2014-04-08 12:30";
        LocalDateTime ldt = LocalDateTime.parse(strDateTime, dtf);
        System.out.println(ldt);

        // However, formatting the obtained LocalDateTime using this DateTimeFormatter
        // will return a string with time in HH:mm:ss format. To restrict the time
        // string to HH:mm format, we still have to use the pattern, uuuu-MM-dd HH:mm as
        // other answers have done.
        String strDateTimeFormatted = ldt.format(dtf);
        System.out.println(strDateTimeFormatted);

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm", Locale.ENGLISH);
        strDateTimeFormatted = ldt.format(formatter);
        System.out.println(strDateTimeFormatted);
    }
}