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

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);

Leave a Comment