Java examples for java.time:Format
get LocalTime For String in format HH:mm:ss
/*// ww w .j a v a 2 s .c om * Copyright 2014-2015 Christian Raue * MIT License http://opensource.org/licenses/mit-license.php */ //package com.java2s; import java.time.LocalTime; import java.time.format.DateTimeFormatter; public class Main { private static final String PATTERN_TIME = "HH:mm:ss"; /** * @param string Zeit-Wert * @return {@link LocalTime}-Objekt mit entsprechendem Zeit-Wert */ public static LocalTime getLocalTimeForString(final String string) { return LocalTime.parse(string, DateTimeFormatter.ofPattern(PATTERN_TIME)); } }