Java examples for java.time:LocalDateTime
get LocalDateTime For String as format dd.MM.yyyy HH:mm:ss
/*/*from w ww . j a v a2s. com*/ * Copyright 2014-2015 Christian Raue * MIT License http://opensource.org/licenses/mit-license.php */ //package com.java2s; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Main { private static final String PATTERN_DATE_TIME = "dd.MM.yyyy HH:mm:ss"; /** * @param string Datum/Zeit-Wert * @return {@link LocalDateTime}-Objekt mit entsprechendem Datum/Zeit-Wert */ public static LocalDateTime getLocalDateTimeForString( final String string) { return LocalDateTime.parse(string, DateTimeFormatter.ofPattern(PATTERN_DATE_TIME)); } }