- 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.LocalTime Class
Introduction
The java.time.LocalTime class represents a time without a time-zone in the ISO-8601 calendar system, such as 10:15:30.
Class declaration
Following is the declaration for java.time.LocalTime class −
pubpc final class LocalTime extends Object implements Temporal, TemporalAdjuster, Comparable<LocalDate>, Seriapzable
Field
Following are the fields for java.time.LocalTime class −
static LocalTime MAX − The maximum supported LocalTime, 23:59:59.999999999 .
static LocalTime MIN − The minimum supported LocalTime, 00:00 .
static LocalTime MIDNIGHT − The time of midnight at the start of the day, 00:00 .
static LocalTime NOON − The time of noon in the middle of the day, 12:00 .
Class methods
Sr.No. | Method & Description |
---|---|
1 | Adjusts the specified temporal object to have the same date and time as this object. |
2 | Combines this time with a date to create a LocalDateTime. |
3 | Combines this time with an offset time to create an OffsetDateTime. |
4 | Compares this time to another time. |
5 | Checks if this time is equal to another time. |
6 | Formats this time using the specified formatter. |
7 | Obtains an instance of LocalTime from a temporal object. |
8 | Gets the value of the specified field from this time as an int. |
9 | Gets the hour-of-day field. |
10 | Gets the value of the specified field from this time as a long. |
11 | Gets the minute-of-hour field. |
12 | Gets the nano-of-second field. |
13 | Gets the second-of-minute field. |
14 | A hash code for this time. |
15 | Checks if this time is after the specified time. |
16 | Checks if this time is before the specified time. |
17 | Checks if the specified field is supported. |
18 | Checks if the specified unit is supported. |
19 | Returns a copy of this time with the specified amount subtracted. |
20 | Returns a copy of this time with the specified amount subtracted. |
21 | Returns a copy of this LocalTime with the specified number of hours subtracted. |
22 | Returns a copy of this LocalTime with the specified number of minutes subtracted. |
23 | Returns a copy of this LocalTime with the specified number of nanoseconds subtracted. |
24 | Returns a copy of this LocalTime with the specified number of seconds subtracted. |
25 | Obtains the current time from the system clock in the default time-zone. |
26 | Obtains the current time from the specified clock. |
27 | Obtains the current time from the system clock in the specified time-zone. |
28 | Obtains an instance of LocalTime from an hour and minute. |
29 | Obtains an instance of LocalTime from an hour, minute and second. |
30 | Obtains an instance of LocalTime from an hour, minute, second and nanosecond. |
31 | Obtains an instance of LocalTime from a nanos-of-day value. |
32 | Obtains an instance of LocalTime from a second-of-day value. |
33 | Obtains an instance of LocalTime from a text string such as 2007-12-03T10:15:30. |
34 | Obtains an instance of LocalTime from a text string using a specific formatter. |
35 | Returns a copy of this time with the specified amount added. |
36 | Returns a copy of this time with the specified amount added. |
37 | Returns a copy of this LocalTime with the specified number of hours added. |
38 | Returns a copy of this LocalTime with the specified number of minutes added. |
39 | Returns a copy of this LocalTime with the specified number of nanoseconds added. |
40 | Returns a copy of this LocalTime with the specified number of seconds added. |
41 | Queries this time using the specified query. |
42 | Gets the range of vapd values for the specified field. |
43 | Extracts the time as nanos of day, from 0 to 24 * 60 * 60 * 1,000,000,000 - 1. |
44 | Extracts the time as seconds of day, from 0 to 24 * 60 * 60 - 1. |
45 | Outputs this date as a String, such as 10:15. |
46 | Returns a copy of this LocalTime with the time truncated. |
47 | Calculates the amount of time until another time in terms of the specified unit. |
48 | Returns an adjusted copy of this time. |
49 | Returns a copy of this time with the specified field set to a new value. |
50 | Returns a copy of this LocalTime with the hour-of-day altered. |
51 | Returns a copy of this LocalTime with the minute-of-hour altered. |
52 | Returns a copy of this LocalTime with the nano-of-second altered. |
53 | Returns a copy of this LocalTime with the second-of-minute altered. |
Methods inherited
This class inherits methods from the following classes −
Java.lang.Object