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.
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:
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:
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:
Example usage:
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
DateandCalendarAPIs whenLocalDateis 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
LocalDatefor 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
- How can I add to List? extends Number data structures?
- How can I clear or empty a StringBuilder?
- How can I combine two HashMap objects containing the same types?
- How can I concatenate two arrays in Java?
- How can I configure encoding in Maven?
- How can I configure Logback to log different levels for a logger to different destinations?
- How can I configure the heap size when starting a Spring Boot application with embedded Tomcat?
- How can I convert a byte array to hexadecimal in Java?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack 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.