Example usage for java.time.temporal TemporalAdjuster interface-usage

List of usage examples for java.time.temporal TemporalAdjuster interface-usage

Introduction

In this page you can find the example usage for java.time.temporal TemporalAdjuster interface-usage.

Usage

From source file Main.java

class FirstTuesdayAdjuster implements TemporalAdjuster {
    @Override
    public Temporal adjustInto(Temporal input) {
        LocalDate date = LocalDate.from(input);
        LocalDate nextMonth = date.plusMonths(1);
        LocalDate firstTuesdayInNextMonth = nextMonth.with(TemporalAdjusters.firstInMonth(DayOfWeek.TUESDAY));

From source file Main.java

/**
 * This temporal adjuster assumes that payday occurs on the 15th
 * and the last day of each month. However, if either of those
 * days lands on a weekend, then the previous Friday is used.
 */
class PaydayAdjuster implements TemporalAdjuster {