The java.time.Clock
class provides access to the current instant, date, and time using a time-zone.
Java Clock Methods
The table below contains common methods of the Java Clock class, each with a link to a detailed explanation, examples, and real-world uses. Click on the method names to learn more about how to use them effectively in your applications.Method | Description |
---|---|
equals() | Checks if this clock is equal to another clock. |
getZone() | Gets the time-zone being used to create dates and times. |
instant() | Gets the current instant of the clock. |
millis() | Gets the current millisecond instant of the clock. |
system() | Gets a clock that returns the current instant using the best available system clock. |
systemUTC() | Gets a clock that returns the current instant using the best available system clock in the UTC time-zone. |
In conclusion, the java.time.Clock
class provides various methods to access the current time in different ways. These methods are essential for handling date and time operations effectively. For more detailed information, refer to the official Java Documentation.