Easy learning with example program codes

Java 8 Instant class

The java.time.Instant class is used to represent the specific moment on the time line

Java Instant class methods

Method Description
Temporal adjustInto(Temporal temporal). It is used to adjust the specified temporal object to have this instant.
int get(TemporalField field) It is used to get the value of the specified field from this instant as an int.
boolean isSupported(TemporalField field) It is used to check if the specified field is supported.
Instant minus(TemporalAmount amountToSubtract) It is used to return a copy of this instant with the specified amount subtracted.
static Instant now() It is used to obtain the current instant from the system clock.
static Instant parse(CharSequence text) It is used to obtain an instance of Instant from a text string such as 2007-12-03T10:15:30.00Z.
Instant plus(TemporalAmount amountToAdd) It is used to return a copy of this instant with the specified amount added.
Instant with(TemporalAdjuster adjuster) It is used to return an adjusted copy of this instant.


package com.codesjava;
import java.time.Instant;
public class TestExample {
	public static void main(String args[]){
	    Instant instant = Instant.parse("2018-04-03T10:32:40.00Z");  
	    //now() method
	    instant =;  


Posted in Date   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki