Java
business days calculation
date manipulation
programming tutorial
Java date libraries

How can I add business days to the current date in Java?

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

Adding business days in Java is not the same as adding calendar days. Business-day logic usually skips Saturdays and Sundays, and many applications also skip holidays.

The simplest correct solution with modern Java is to use LocalDate from java.time, then advance one day at a time while counting only valid business days. It is not mathematically fancy, but it is readable, correct, and easy to extend for holidays.

Start with LocalDate

For modern Java code, use LocalDate rather than the older Date or Calendar APIs:

java
1import java.time.LocalDate;
2
3LocalDate today = LocalDate.now();
4System.out.println(today);

LocalDate is ideal here because business-day calculations are date-based, not time-of-day based.

Add Business Days by Skipping Weekends

A straightforward implementation looks like this:

java
1import java.time.DayOfWeek;
2import java.time.LocalDate;
3
4public class BusinessDays {
5    public static LocalDate addBusinessDays(LocalDate start, int businessDays) {
6        if (businessDays < 0) {
7            throw new IllegalArgumentException("businessDays must be >= 0");
8        }
9
10        LocalDate date = start;
11        int added = 0;
12
13        while (added < businessDays) {
14            date = date.plusDays(1);
15            if (isBusinessDay(date)) {
16                added++;
17            }
18        }
19
20        return date;
21    }
22
23    private static boolean isBusinessDay(LocalDate date) {
24        DayOfWeek day = date.getDayOfWeek();
25        return day != DayOfWeek.SATURDAY && day != DayOfWeek.SUNDAY;
26    }
27
28    public static void main(String[] args) {
29        LocalDate result = addBusinessDays(LocalDate.now(), 5);
30        System.out.println(result);
31    }
32}

This is the right baseline for many internal tools and scheduling tasks.

Add Holidays to the Calculation

Real business calendars often exclude more than weekends. You can pass a holiday set and reject those dates too:

java
1import java.time.DayOfWeek;
2import java.time.LocalDate;
3import java.util.Set;
4
5public class BusinessDaysWithHolidays {
6    public static LocalDate addBusinessDays(LocalDate start, int businessDays, Set<LocalDate> holidays) {
7        LocalDate date = start;
8        int added = 0;
9
10        while (added < businessDays) {
11            date = date.plusDays(1);
12            if (isBusinessDay(date, holidays)) {
13                added++;
14            }
15        }
16
17        return date;
18    }
19
20    private static boolean isBusinessDay(LocalDate date, Set<LocalDate> holidays) {
21        DayOfWeek day = date.getDayOfWeek();
22        return day != DayOfWeek.SATURDAY
23            && day != DayOfWeek.SUNDAY
24            && !holidays.contains(date);
25    }
26}

Example usage:

java
1Set<LocalDate> holidays = Set.of(
2    LocalDate.of(2026, 1, 1),
3    LocalDate.of(2026, 12, 25)
4);
5
6LocalDate dueDate = BusinessDaysWithHolidays.addBusinessDays(LocalDate.now(), 10, holidays);
7System.out.println(dueDate);

This gives you a simple but realistic business calendar.

Decide Whether the Start Date Counts

One subtle requirement is whether the starting day itself should count as business day number one. The earlier implementation starts counting from the next day.

That is usually what people mean by "add business days," but not always. If the current date should count when it is already a business day, the logic must change. Make that rule explicit in your method contract.

Keep the Logic Date-Based

Business-day addition usually should not depend on time zone offsets, daylight saving transitions, or times of day. That is why LocalDate is better than date-time classes for this task.

If your system starts from a timestamp, convert it to the relevant local date first, do the business-day math, and only then attach time information again if needed.

Common Pitfalls

  • Using old Date and Calendar APIs when LocalDate is a better fit.
  • Forgetting to define whether the start date counts.
  • Skipping weekends but ignoring business holidays.
  • Doing time-zone-heavy date-time logic when only a date is required.
  • Assuming every business calendar uses Saturday and Sunday weekends.

Summary

  • Use LocalDate for business-day calculations in modern Java.
  • Add days one by one and count only valid business days.
  • Exclude weekends by default and holidays when needed.
  • Make it explicit whether the start date counts toward the total.
  • Keep the calculation date-based unless time-of-day logic is truly required.

Related reading
Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.