Answers for "java how to convert custom time string to a time format"

1

convert datetime to custom format in java 8

DateTimeFormatter oldPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter newPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");

LocalDateTime datetime = LocalDateTime.parse(input, oldPattern); 
String output = datetime.format(newPattern);
Posted by: Guest on July-27-2021

Code answers related to "java how to convert custom time string to a time format"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language