Java Tutorials


Java 8 Date Time Classes

Instant class Usage

   Instant represents Point of Time in time-line, This is machine specific class. This class might be using system hardware clock to get date and time.

Creating a Instant Object. Instant's

now()

method returns system's date and time.
      		Instant ins = Instant.now();
      		
      		System.out.println(ins);
      		2023-01-24T17:21:08.685682Z
      

ADS