OffsetTime parse(CharSequence text, DateTimeFormatter formatter)
creates
an instance of OffsetTime from a text string using a specific formatter.
parse
has the following syntax.
public static OffsetTime parse(CharSequence text, DateTimeFormatter formatter)
The following example shows how to use parse
.
import java.time.OffsetTime; import java.time.format.DateTimeFormatter; /*from w w w . j a v a 2s . c o m*/ public class Main { public static void main(String[] args) { OffsetTime m = OffsetTime.parse("18:26:06.325-07:00",DateTimeFormatter.ISO_OFFSET_TIME); System.out.println(m); } }
The code above generates the following result.