OffsetDateTime parse(CharSequence text)
creates
an instance of OffsetDateTime from a text string
such as 2014-12-03T10:15:30+01:00.
The string must represent a valid date-time and is parsed using
. DateTimeFormatter.ISO_OFFSET_DATE_TIME
parse
has the following syntax.
public static OffsetDateTime parse(CharSequence text)
The following example shows how to use parse
.
import java.time.OffsetDateTime; public class Main { public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.parse("2014-09-02T15:22:14.59-07:00"); System.out.println(o); } }
The code above generates the following result.