OffsetTime parse(CharSequence text) example
Description
OffsetTime parse(CharSequence text)
creates
an instance of OffsetTime from a text string such as 10:15:30+01:00.
The string must represent a valid time and is parsed using
DateTimeFormatter.ISO_OFFSET_TIME
.
Syntax
parse
has the following syntax.
public static OffsetTime parse(CharSequence text)
Example
The following example shows how to use parse
.
import java.time.OffsetTime;
//from w w w. j av a 2 s . co m
public class Main {
public static void main(String[] args) {
OffsetTime m = OffsetTime.parse("18:26:06.325-07:00");
System.out.println(m);
}
}
The code above generates the following result.