Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › time › temporal › ChronoUnit.html
ChronoUnit (Java SE 17 & JDK 17)
January 20, 2026 - declaration: module: java.base, package: java.time.temporal, enum: ChronoUnit
Yawk
code.yawk.at › java › 17 › java.base › java › time › temporal › ChronoUnit.java
java/17 : java.base/java/time/temporal/ChronoUnit.java
* The estimated duration of this unit is artificially defined as the largest duration * supported by {@link Duration}. */ FOREVER("Forever", Duration.ofSeconds(Long.MAX_VALUE, 999_999_999)); private final String name; private final Duration duration; private ChronoUnit(String name, Duration estimatedDuration) { this.name = name; this.duration = estimatedDuration; } //-----------------------------------------------------------------------
Oracle
docs.oracle.com › javase › 8 › docs › api › java › time › temporal › ChronoUnit.html
ChronoUnit (Java Platform SE 8 )
1 week ago - for (ChronoUnit c : ChronoUnit.values()) System.out.println(c);
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › time › temporal › ChronoUnit.html
ChronoUnit (Java SE 11 & JDK 11 )
January 20, 2026 - java.lang.Enum<ChronoUnit> java.time.temporal.ChronoUnit · All Implemented Interfaces: Serializable, Comparable<ChronoUnit>, TemporalUnit · public enum ChronoUnit extends Enum<ChronoUnit> implements TemporalUnit · A standard set of date periods units. This set of units provide unit-based ...
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › time › temporal › class-use › ChronoUnit.html
Uses of Enum Class java.time.temporal.ChronoUnit (Java SE 17 & JDK 17)
October 20, 2025 - Converts this TimeUnit to the equivalent ChronoUnit. Methods in java.util.concurrent with parameters of type ChronoUnit
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › time › temporal › Temporal.html
Temporal (Java SE 17 & JDK 17)
January 20, 2026 - Implementations must check and handle all units defined in ChronoUnit. If the unit is supported, then the addition must be performed.
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › time › temporal › TemporalUnit.html
TemporalUnit (Java SE 17 & JDK 17)
October 20, 2025 - The unit works using double dispatch. Client code calls methods on a date-time like LocalDateTime which check if the unit is a ChronoUnit. If it is, then the date-time must handle it.
o7planning
o7planning.org › 13745 › java-chronounit
Java ChronoUnit Tutorial with Examples | o7planning.org
ZonedDateTime parisNow = ZonedDateTime.now(ZoneId.of("Europe/Paris")); System.out.println("Now in Paris: " + parisNow); ZonedDateTime parisNowHour = parisNow.truncatedTo(ChronoUnit.HOURS); System.out.println("Truncated to Hour: " + parisNowHour); ... Now in Paris: 2021-07-17T05:40:15.939515+02:00[Europe/Paris] Truncated to Hour: 2021-07-17T05:00+02:00[Europe/Paris]
GitHub
github.com › frohoff › jdk8u-jdk › blob › master › src › share › classes › java › time › temporal › ChronoUnit.java
jdk8u-jdk/src/share/classes/java/time/temporal/ChronoUnit.java at master · frohoff/jdk8u-jdk
January 10, 2018 - public enum ChronoUnit implements TemporalUnit { · /** * Unit that represents the concept of a nanosecond, the smallest supported unit of time. * For the ISO calendar system, it is equal to the 1,000,000,000th part of the second unit.
Author frohoff
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › time › chrono › ChronoLocalDate.html
ChronoLocalDate (Java SE 17 & JDK 17)
April 15, 2025 - The calculation is implemented in this method for ChronoUnit. The units DAYS, WEEKS, MONTHS, YEARS, DECADES, CENTURIES, MILLENNIA and ERAS should be supported by all implementations.
Intrexx
help.intrexx.com › apidocs › jdk17 › api › java.base › java › util › concurrent › TimeUnit.html
TimeUnit (Java SE 17 & JDK 17)
Converts a ChronoUnit to the equivalent TimeUnit.
Oracle
docs.oracle.com › javase › 10 › docs › api › java › time › temporal › ChronoUnit.html
ChronoUnit (Java SE 10 & JDK 10 )
java.lang.Enum<ChronoUnit> java.time.temporal.ChronoUnit · All Implemented Interfaces: Serializable, Comparable<ChronoUnit>, TemporalUnit · public enum ChronoUnit extends Enum<ChronoUnit> implements TemporalUnit · A standard set of date periods units. This set of units provide unit-based ...
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › time › temporal › ChronoUnit.html
ChronoUnit (Java SE 21 & JDK 21)
January 20, 2026 - Implementations should perform any queries or calculations using the units available in ChronoUnit or the fields available in ChronoField. If the unit is not supported an UnsupportedTemporalTypeException must be thrown.
JetBrains
youtrack.jetbrains.com › issue › KTIJ-20809 › Cant-import-javatimetemporalChronoUnit-due-to-absence-of-it-in-pop-up-window
Can't import java.time.temporal.ChronoUnit due to absence ...
{{ (>_<) }} This version of your browser is not supported. Try upgrading to the latest stable version. Something went seriously wrong
Stack Overflow
stackoverflow.com › questions › 72778921 › how-to-find-the-first-day-of-any-chronounit-including-quarters-in-java
datetime - How to find the first day of any ChronoUnit including quarters in Java? - Stack Overflow
ChronoUnit unit = ChronoUnit.MONTHS(WEEKS, QUARTERS, YEARS, DAYS); // Supplied by an enum instance DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd"); LocalDate start = LocalDate.parse("1990-12-15",df); LocalDate end = LocalDate.parse("1991-06-07",df); LocalDate lastCompoundDate = end; LocalDate current = start; ArrayList compoundingDates = new ArrayList<LocalDate>(); while (current.isBefore(end)) { compoundingDates.add(current); current = findFirstDateOf(current.plus(duration, unit), unit); } compoundingDates.add(end) return CompoundingDates
Yawk
code.yawk.at › java › 17 › java.base › java › time › chrono › ChronoZonedDateTime.java
java/17 : java.base/java/time/chrono/ChronoZonedDateTime.java
* <p> * The set of supported units is defined by the chronology and normally includes * all {@code ChronoUnit} units except {@code FOREVER}. * <p> * If the unit is not a {@code ChronoUnit}, then the result of this method * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)} * passing {@code this} as the argument.
Top answer 1 of 2
16
Instant#now() obtains the current instant from the system clock. If the system clock returns a precision of only up to microseconds, the Instant#toString simply truncates the last three zeros from the nine digits. If the system on which you are running Java 17 (correto17) returns a precision of nanoseconds, you can truncate it to the precision of microseconds using Instant#truncatedTo(java.time.temporal.TemporalUnit).
public class Main {
public static void main(String args[]) {
Instant instant = Instant.now();
Instant truncatedToMicros = instant.truncatedTo(ChronoUnit.MICROS);
System.out.println(truncatedToMicros);
}
}
Learn more about the modern Date-Time API from Trail: Date Time.
2 of 2
1
Yes, and what we need to notice is that when we use MacOS, the time API will just works as 6 digs precision, but when we use Linux(such as Ubuntu), it will be 9 digs : )
Android Developers
developer.android.com › api reference › chronounit
ChronoUnit | API reference | Android Developers
Skip to main content · English · Deutsch · Español – América Latina · Français · Indonesia · Polski · Português – Brasil · Tiếng Việt · 中文 – 简体