Instant now()
gets the current instant from the system clock.
now
has the following syntax.
public static Instant now()
The following example shows how to use now
.
import java.time.Instant; public class Main { public static void main(String[] args) { Instant instant = Instant.now(); System.out.println(instant.getEpochSecond()); } }
The code above generates the following result.