Why am I getting a parse exception when I try to parse the current LocalDateTime [duplicate]

Solution 1:

You can change it to ISO_DATE_TIME which gives you the "T"

DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;

        LocalDateTime timeStamp=  LocalDateTime.parse(LocalDateTime.now().toString(),formatter);
        System.out.println(timeStamp);