Close

Java Date Time - Instant.parse() Examples

Java Date Time Java Java API 


Class:

java.time.Instant

java.lang.Objectjava.lang.Objectjava.time.Instantjava.time.Instantjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Method:

public static Instant parse(CharSequence text)

Obtains an instance of Instant from a string such as 2007-12-03T10:15:30.00Z.

The string must represent a valid instant using DateTimeFormatter.ISO_INSTANT .


Examples


package com.logicbig.example.instant;

import java.time.Instant;

public class ParseExample {

public static void main(String... args) {
Instant i = Instant.parse("2014-10-03T10:15:30.300Z");
System.out.println(i);
}
}

Output

2014-10-03T10:15:30.300Z




See Also