On this page
  1. Instant
  2. Import
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

Instant

Prev: java.time | Up: java.time | Next: `LocalDate`
Rel: java.time, java/builtins
Ref: Java Docs — Instant
Tags: #public #prog #java #stdlib #java_time #tier/core


Import

import java.time.*;

Signature & Overview

Instant.now()  /* UTC epoch timestamp */

Machine timestamp on the UTC timeline with nanosecond precision.

Notes & Pitfalls

Example

import java.time.Instant;

Instant t = Instant.parse("2026-12-02T12:00:00Z");
assert t.plusSeconds(60).isAfter(t);

Linked from

Related notes