I was just playing with Java 8 Date time API.
My code looks like this.
LocalDateTime date=LocalDateTime.now(ZoneId.of("America/New_York"));
System.out.println("date now:"+date);
String ormat = ZonedDateTime.now().format(DateTimeFormatter.ofPattern("dd/MMM/yyyy HH:mm:ss"));
//=date.format(DateTimeFormatter.ofPattern("dd/MMM/yyyy'T'hh:mm:ss.SX Z"));
LocalDateTime date2=LocalDateTime.parse(format);
System.out.println("dsate now:"+date2);
But it is showing this error
Exception in thread "main" java.time.format.DateTimeParseException: Text '14/Oct/2016 23:13:57' could not be parsed at index 0
I tried with this pattern
String format=ZonedDateTime.now().format(DateTimeFormatter.ofPattern("dd/MMM/yyyy HH:mm:ss.SSSS Z"));
Still didn't work.
I checked the answers here and here.
Edit: One thing also I want to know what if I want my date object only in this format?
Edit 2: What I try to achieve is that have some date and time what I got using localDateTime and I want to format it using the formatter I have used in code.