- 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.LocalDateTime Class
Introduction
The java.time.LocalDateTime class represents a date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.
Class declaration
Following is the declaration for java.time.LocalDateTime class −
pubpc final class LocalDateTime extends Object implements Temporal, TemporalAdjuster, ChronoLocalDateTime, Seriapzable
Field
Following are the fields for java.time.LocalDateTime class −
static LocalDateTime MAX − The maximum supported LocalDateTime, +999999999-12-31T23:59:59.999999999 .
static LocalDateTime MIN − The minimum supported LocalDateTime, -999999999-01-01T00:00: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 date-time with an offset time to create an OffsetDateTime. |
3 | Combines this date-time with a timezone to create a ZonedDateTime. |
4 | Compares this date-time to another date-time. |
5 | Checks if this date-time is equal to another date-time. |
6 | Formats this date-time using the specified formatter. |
7 | Obtains an instance of LocalDateTime from a temporal object. |
8 | Gets the value of the specified field from this date-time as an int. |
9 | Gets the day-of-month field. |
10 | Gets the day-of-week field, which is an enum DayOfWeek. |
11 | Gets the day-of-year field. |
12 | Gets the hour-of-day field. |
13 | Gets the value of the specified field from this date-time as a long. |
14 | Gets the minute-of-hour field. |
15 | Gets the month-of-year field using the Month enum. |
16 | Gets the month-of-year field from 1 to 12. |
17 | Gets the nano-of-second field. |
18 | Gets the second-of-minute field. |
19 | Gets the year field. |
20 | A hash code for this date-time. |
21 | Checks if this date-time is after the specified date-time. |
22 | Checks if this date-time is before the specified date-time. |
23 | Checks if this date-time is equal to the specified date-time. |
24 | Checks if the specified field is supported. |
25 | Checks if the specified unit is supported. |
26 | Returns a copy of this date-time with the specified amount subtracted. |
27 | Returns a copy of this date-time with the specified amount subtracted. |
28 | Returns a copy of this LocalDateTime with the specified number of days subtracted. |
29 | Returns a copy of this LocalDateTime with the specified number of hours subtracted. |
30 | Returns a copy of this LocalDateTime with the specified number of minutes subtracted. |
31 | Returns a copy of this LocalDateTime with the specified number of months subtracted. |
32 | Returns a copy of this LocalDateTime with the specified number of nanoseconds subtracted. |
33 | Returns a copy of this LocalDateTime with the specified number of seconds subtracted. |
34 | Returns a copy of this LocalDateTime with the specified number of weeks subtracted. |
35 | Returns a copy of this LocalDateTime with the specified number of years subtracted. |
36 | Obtains the current date-time from the system clock in the default time-zone. |
37 | Obtains the current date-time from the specified clock. |
38 | Obtains the current date-time from the system clock in the specified time-zone. |
39 | Obtains an instance of LocalDateTime from year, month, day, hour and minute, setting the second and nanosecond to zero. |
40 | Obtains an instance of LocalDateTime from year, month, day, hour, minute and second, setting the nanosecond to zero. |
41 | Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond. |
42 | Obtains an instance of LocalDateTime from year, month, day, hour, minute and second, setting the nanosecond to zero. |
43 | Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond. |
44 | Obtains an instance of LocalDateTime from a date and time. |
45 | Obtains an instance of LocalDateTime from the epoch of 1970-01-01T00:00:00Z. |
46 | Obtains an instance of LocalDateTime from an Instant and zone ID. |
47 | Obtains an instance of LocalDateTime from a text string such as 2007-12-03T10:15:30. |
48 | Obtains an instance of LocalDateTime from a text string using a specific formatter. |
49 | Returns a copy of this date-time with the specified amount added. |
50 | Returns a copy of this date-time with the specified amount added. |
51 | Returns a copy of this LocalDateTime with the specified number of days added. |
52 | Returns a copy of this LocalDateTime with the specified number of hours added. |
53 | Returns a copy of this LocalDateTime with the specified number of minutes added. |
54 | Returns a copy of this LocalDateTime with the specified number of months added. |
55 | Returns a copy of this LocalDateTime with the specified number of nanoseconds added. |
56 | Returns a copy of this LocalDateTime with the specified number of seconds added. |
57 | Returns a copy of this LocalDateTime with the specified number of weeks added. |
58 | Returns a copy of this LocalDateTime with the specified number of years added. |
59 | Queries this date-time using the specified query. |
60 | Gets the range of vapd values for the specified field. |
61 | Gets the LocalDate part of this date-time. |
62 | Gets the LocalTime part of this date-time. |
63 | Outputs this date as a String, such as 2007-12-03T10:15:30. |
64 | Returns a copy of this LocalDateTime with the time truncated. |
65 | Calculates the amount of time until another date-time in terms of the specified unit. |
66 | Returns an adjusted copy of this date-time. |
67 | Returns a copy of this date-time with the specified field set to a new value. |
68 | Returns a copy of this LocalDateTime with the day-of-month altered. |
69 | Returns a copy of this LocalDateTime with the day-of-year altered. |
70 | Returns a copy of this LocalDateTime with the hour-of-day altered. |
71 | Returns a copy of this LocalDateTime with the minute-of-hour altered. |
72 | Returns a copy of this LocalDateTime with the month-of-year altered. |
73 | Returns a copy of this LocalDateTime with the nano-of-second altered. |
74 | Returns a copy of this LocalDateTime with the second-of-minute altered. |
75 | Returns a copy of this LocalDateTime with the year altered. |
Methods inherited
This class inherits methods from the following classes −
Java.lang.Object