Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/time/temporal/TemporalAdjuster#pubmethods)

# TemporalAdjuster

` public interface TemporalAdjuster `   
` `

|---|
| java.time.temporal.TemporalAdjuster |

Known indirect subclasses [ChronoLocalDate](https://developer.android.com/reference/java/time/chrono/ChronoLocalDate), [ChronoLocalDateTime](https://developer.android.com/reference/java/time/chrono/ChronoLocalDateTime)\<D extends [ChronoLocalDate](https://developer.android.com/reference/java/time/chrono/ChronoLocalDate)\>, [DayOfWeek](https://developer.android.com/reference/java/time/DayOfWeek), [Era](https://developer.android.com/reference/java/time/chrono/Era), [HijrahDate](https://developer.android.com/reference/java/time/chrono/HijrahDate), [HijrahEra](https://developer.android.com/reference/java/time/chrono/HijrahEra), [Instant](https://developer.android.com/reference/java/time/Instant), [IsoEra](https://developer.android.com/reference/java/time/chrono/IsoEra), [JapaneseDate](https://developer.android.com/reference/java/time/chrono/JapaneseDate), [JapaneseEra](https://developer.android.com/reference/java/time/chrono/JapaneseEra), [LocalDate](https://developer.android.com/reference/java/time/LocalDate), [LocalDateTime](https://developer.android.com/reference/java/time/LocalDateTime), [LocalTime](https://developer.android.com/reference/java/time/LocalTime), [MinguoDate](https://developer.android.com/reference/java/time/chrono/MinguoDate), [MinguoEra](https://developer.android.com/reference/java/time/chrono/MinguoEra), and 9 others. [ChronoLocalDate](https://developer.android.com/reference/java/time/chrono/ChronoLocalDate) A date without time-of-day or time-zone in an arbitrary chronology, intended for advanced globalization use cases. [ChronoLocalDateTime](https://developer.android.com/reference/java/time/chrono/ChronoLocalDateTime)\<D extends [ChronoLocalDate](https://developer.android.com/reference/java/time/chrono/ChronoLocalDate)\> A date-time without a time-zone in an arbitrary chronology, intended for advanced globalization use cases. [DayOfWeek](https://developer.android.com/reference/java/time/DayOfWeek) A day-of-week, such as 'Tuesday'. [Era](https://developer.android.com/reference/java/time/chrono/Era) An era of the time-line. [HijrahDate](https://developer.android.com/reference/java/time/chrono/HijrahDate) A date in the Hijrah calendar system. [HijrahEra](https://developer.android.com/reference/java/time/chrono/HijrahEra) An era in the Hijrah calendar system. [Instant](https://developer.android.com/reference/java/time/Instant) An instantaneous point on the time-line. [IsoEra](https://developer.android.com/reference/java/time/chrono/IsoEra) An era in the ISO calendar system. [JapaneseDate](https://developer.android.com/reference/java/time/chrono/JapaneseDate) A date in the Japanese Imperial calendar system. [JapaneseEra](https://developer.android.com/reference/java/time/chrono/JapaneseEra) An era in the Japanese Imperial calendar system. [LocalDate](https://developer.android.com/reference/java/time/LocalDate) A date without a time-zone in the ISO-8601 calendar system, such as `2007-12-03`. [LocalDateTime](https://developer.android.com/reference/java/time/LocalDateTime) A date-time without a time-zone in the ISO-8601 calendar system, such as `2007-12-03T10:15:30`. [LocalTime](https://developer.android.com/reference/java/time/LocalTime) A time without a time-zone in the ISO-8601 calendar system, such as `10:15:30`. [MinguoDate](https://developer.android.com/reference/java/time/chrono/MinguoDate) A date in the Minguo calendar system. [MinguoEra](https://developer.android.com/reference/java/time/chrono/MinguoEra) An era in the Minguo calendar system. [Month](https://developer.android.com/reference/java/time/Month) A month-of-year, such as 'July'. [MonthDay](https://developer.android.com/reference/java/time/MonthDay) A month-day in the ISO-8601 calendar system, such as `--12-03`. [OffsetDateTime](https://developer.android.com/reference/java/time/OffsetDateTime) A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as `2007-12-03T10:15:30+01:00`. [OffsetTime](https://developer.android.com/reference/java/time/OffsetTime) A time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as `10:15:30+01:00`. [ThaiBuddhistDate](https://developer.android.com/reference/java/time/chrono/ThaiBuddhistDate) A date in the Thai Buddhist calendar system. [ThaiBuddhistEra](https://developer.android.com/reference/java/time/chrono/ThaiBuddhistEra) An era in the Thai Buddhist calendar system. [Year](https://developer.android.com/reference/java/time/Year) A year in the ISO-8601 calendar system, such as `2007`. [YearMonth](https://developer.android.com/reference/java/time/YearMonth) A year-month in the ISO-8601 calendar system, such as `2007-12`. [ZoneOffset](https://developer.android.com/reference/java/time/ZoneOffset) A time-zone offset from Greenwich/UTC, such as `+02:00`.   

*** ** * ** ***

Strategy for adjusting a temporal object.

Adjusters are a key tool for modifying temporal objects. They exist to externalize the process of adjustment, permitting different approaches, as per the strategy design pattern. Examples might be an adjuster that sets the date avoiding weekends, or one that sets the date to the last day of the month.

There are two equivalent ways of using a `TemporalAdjuster`. The first is to invoke the method on this interface directly. The second is to use `https://developer.android.com/reference/java/time/temporal/Temporal#with(java.time.temporal.TemporalAdjuster)`:

```
  // these two lines are equivalent, but the second approach is recommended
  temporal = thisAdjuster.adjustInto(temporal);
  temporal = temporal.with(thisAdjuster);
```
It is recommended to use the second approach, `with(TemporalAdjuster)`, as it is a lot clearer to read in code.

The `https://developer.android.com/reference/java/time/temporal/TemporalAdjusters` class contains a standard set of adjusters, available as static methods. These include:

- finding the first or last day of the month
- finding the first day of next month
- finding the first or last day of the year
- finding the first day of next year
- finding the first or last day-of-week within a month, such as "first Wednesday in June"
- finding the next or previous day-of-week, such as "next Thursday"

<br />

**See also:**

- `https://developer.android.com/reference/java/time/temporal/TemporalAdjusters`

## Summary

| ### Public methods ||
|---|---|
| ` abstract https://developer.android.com/reference/java/time/temporal/Temporal` | ` https://developer.android.com/reference/java/time/temporal/TemporalAdjuster#adjustInto(java.time.temporal.Temporal)(https://developer.android.com/reference/java/time/temporal/Temporal temporal) ` Adjusts the specified temporal object. |

## Public methods

### adjustInto

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Temporal adjustInto (Temporal temporal)
```

Adjusts the specified temporal object.

This adjusts the specified temporal object using the logic encapsulated in the implementing class. Examples might be an adjuster that sets the date avoiding weekends, or one that sets the date to the last day of the month.

There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use `https://developer.android.com/reference/java/time/temporal/Temporal#with(java.time.temporal.TemporalAdjuster)`:

```
  // these two lines are equivalent, but the second approach is recommended
  temporal = thisAdjuster.adjustInto(temporal);
  temporal = temporal.with(thisAdjuster);
```
It is recommended to use the second approach, `with(TemporalAdjuster)`, as it is a lot clearer to read in code.

<br />

<br />

##### Implementation Requirements:

- The implementation must take the input object and adjust it. The implementation defines the logic of the adjustment and is responsible for documenting that logic. It may use any method on `Temporal` to query the temporal object and perform the adjustment. The returned object must have the same observable type as the input object

  The input object must not be altered. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable temporal objects.

  The input temporal object may be in a calendar system other than ISO. Implementations may choose to document compatibility with other calendar systems, or reject non-ISO temporal objects by `https://developer.android.com/reference/java/time/temporal/TemporalQueries#chronology()`.

  This method may be called from multiple threads in parallel. It must be thread-safe when invoked.

| Parameters ||
|---|---|
| `temporal` | `Temporal`: the temporal object to adjust, not null <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/time/temporal/Temporal` | an object of the same observable type with the adjustment made, not null <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArithmeticException` | if numeric overflow occurs |
| `https://developer.android.com/reference/java/time/DateTimeException` | if unable to make the adjustment |