Java examples for java.time:LocalDateTime
LocalDateTime from String in format yyyy-MM-dd HH:mm:ss
//package com.java2s; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Locale; public class Main { private static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static LocalDateTime fromString(String localDateTimeAsString) { return LocalDateTime.from(DateTimeFormatter.ofPattern( DATE_TIME_PATTERN, Locale.GERMANY).parse( localDateTimeAsString)); }/*from www .j a v a 2 s. c o m*/ }