- java.time - Discussion
- java.time - Month
- java.time - ZoneOffset
- java.time - ZoneId
- java.time - ZonedDateTime
- java.time - YearMonth
- java.time - Year
- java.time - Period
- java.time - OffsetTime
- java.time - OffsetDateTime
- java.time - MonthDay
- java.time - LocalTime
- java.time - LocalDateTime
- java.time - LocalDate
- java.time - Instant
- java.time - Duration
- java.time - Clock
- java.time - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
java.time.Clock Class
Introduction
The java.time.Clock class provides access to the current instant, date and time using a time-zone.
Class declaration
Following is the declaration for java.io.Clock class −
pubpc abstract class Clock extends Object
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 | protected Clock() This creates a Clock. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method checks if this clock is equal to another clock. |
2 | This method obtains a clock that always returns the same instant. |
3 | This method gets the time-zone being used to create dates and times. |
4 | This method gets a hash code for this clock. |
5 | This method gets the current instant of the clock. |
6 | This method gets the current milpsecond instant of the clock. |
7 | This method obtains a clock that returns instants from the specified clock with the specified duration added. |
8 | This method obtains a clock that returns the current instant using best available system clock. |
9 | This method obtains a clock that returns the current instant using the best available system clock, converting to date and time using the default time-zone. |
10 | This method obtains a clock that returns the current instant using the best available system clock, converting to date and time using the UTC time-zone. |
11 | This method obtains a clock that returns instants from the specified clock truncated to the nearest occurrence of the specified duration. |
12 | This method obtains a clock that returns the current instant ticking in whole minutes using best available system clock. |
13 | This method obtains a clock that returns the current instant ticking in whole seconds using best available system clock. |
14 | This method returns a copy of this clock with a different time-zone. |
Methods inherited
This class inherits methods from the following classes −
Java.lang.Object