convert datetime to custom format in java 8

Solutions on MaxInterview for convert datetime to custom format in java 8 by the best coders in the world

showing results for - "convert datetime to custom format in java 8"
Elias
18 Feb 2019
1DateTimeFormatter oldPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
2DateTimeFormatter newPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
3
4LocalDateTime datetime = LocalDateTime.parse(input, oldPattern); 
5String output = datetime.format(newPattern);