Tool
Java Unix Timestamp Snippets
Java examples for current epoch seconds, milliseconds, Instant conversion, timezone-aware formatting, and modern java.time APIs.
Java timestamp basics
Modern Java code should prefer java.time.Instant for timestamp work. Instant.now().getEpochSecond() gives Unix seconds and Instant.now().toEpochMilli() gives Unix milliseconds.
Timezone-aware Java formatting
Convert an Instant to a ZonedDateTime with ZoneId when displaying local time. Keep storage and comparisons in Instant or UTC, then format only at the edge of the application.