Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To decide whether a date is a holiday, first decide whose calendar applies: a government, bank, stock exchange, employer, school, or another organization. Java can help calculate dates, but it cannot determine which authority’s holiday and observance rules your application should follow.

John D. Mitchell’s Java Tip 44, published by InfoWorld on January 1, 1998, explored that problem through a proposed international calendar applet and selected U.S. examples. Its policy-first lesson remains useful; its applet-era code and sample schedules are historical, not current Java guidance or a complete calendar.

What does “holiday” mean for an application?

The same date can be a public holiday for one jurisdiction, a normal workday for an employer, and a trading day for a market. The original tip puts the key question plainly: “Which holidays do I indicate — government/banking holidays and/or stock exchange holidays?” The correct answer depends on what the calendar is meant to do.

Choose the authority and purpose before writing date logic. A display calendar, business-day calculator, market schedule, and employee leave planner can all need different holiday sets, even when they cover the same place.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Authority: government, bank, exchange, employer, school, or another organization.
  • Geography: country and, where relevant, state, province, municipality, or locale.
  • Purpose: showing dates, calculating working days, determining market sessions, or planning leave.

Mitchell’s examples explicitly caution that rules vary among states, municipalities, provinces, and industries. They should be read as illustrations of rule patterns, not as a definitive schedule for every institution.

Which kinds of rules does Java Tip 44 describe?

The tip groups holiday rules into a few recurring patterns. Real calendars may combine them, and the pattern that determines a date does not by itself decide whether an organization observes it.

Fixed calendar dates

Some holidays fall on the same month and day each year. The tip uses dates such as New Year’s Day, Independence Day, Veterans Day, and Christmas to illustrate this kind of rule.

A weekday’s position in a month

Other dates are defined by weekday and position, such as the third Monday in January or February, or the fourth Thursday in November. The article’s U.S. examples include Martin Luther King Jr. Day, Presidents’ Day, and Thanksgiving. Memorial Day is described as the last Monday in May.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Weekend observance shifts

An organization may move its observance when a fixed-date holiday falls on a weekend. The article describes Friday observance when a holiday falls on Saturday and Monday observance when it falls on Sunday as frequent practices—not universal rules. It also notes variation in Veterans Day weekend observances. The relevant institution’s policy, rather than a general rule of thumb, must control the result.

Formula-based dates and combinations

Some holidays depend on a calculation rather than a fixed date or weekday position. The tip discusses Easter Sunday and Good Friday, including NYSE Good Friday as an example, and notes that a holiday may combine more than one of the patterns above. It asserts that the Easter/NYSE Good Friday formula “repeats itself every 5,700,000 years in the Gregorian calendar”; that figure is a claim made in the 1998 article, not an independently verified modern calendar or astronomical fact.

Why the examples are not a complete U.S. holiday calendar

The tip’s sample methods cover New Year’s Day and its observance, Martin Luther King Jr. Day, Presidents’ Day, Good Friday, Memorial Day, Independence Day, Labor Day, Columbus Day, Veterans Day, Thanksgiving, and Christmas. They demonstrate ways to calculate selected dates, but not which dates every government body, bank, exchange, or employer must recognize.

The article itself points to differences in local and institutional policy. It notes, for example, that some jurisdictions may not formally observe Martin Luther King Jr. Day and that Veterans Day weekend rules can vary. Do not use the sample list as a current, all-jurisdiction specification or assume a calculated date automatically means an office or market is closed.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What changes when a calendar serves international users?

An international calendar must treat locale as more than a translated label. Users may expect different first days of the week, calendar displays, civil calendar conventions, and holiday sets. A single language setting does not establish the user’s country or the authority whose calendar is relevant.

The article also discusses the Hijri calendar, which is lunar, and explains that the start of a month can depend on crescent-sighting practice. Different authorities or locations may therefore use different starting days. For a particular religious or governmental date, an application should use the relevant contemporary authority; the 1998 article’s explanation is not a current date determination.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How should you approach this in modern Java?

Mitchell’s code uses applets and legacy java.util.Date methods. Those examples are historical and should not be copied as modern Java practice. Oracle’s Java Tutorials describe the java.time API as introduced in Java SE 8 and explain drawbacks of legacy date-time classes, including mutability, weak type safety, and unusual month numbering. The tutorials’ examples target JDK 8 and point readers to Dev.java for updated tutorials, so they are useful background rather than exhaustive documentation for every current Java release.

Represent a date separately from its observance policy

For a rule that concerns only a calendar date, java.time.LocalDate is a sensible starting point: it represents a year, month, and day without a time or time zone. A rule such as “last Monday in May” can be expressed as date arithmetic. Whether that date is a day off for a particular office, bank, or exchange is a separate policy decision.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Oracle also documents alternative calendar systems through java.time.chrono. Choosing a date type or calendar system does not supply an organization’s holiday schedule or determine which lunar month-start convention it follows.

Keep the rule and the policy explicit

A robust calendar implementation should distinguish the date a rule calculates from the authority’s decision to observe it. For each calendar, record the jurisdiction and organization, the calendar system and any relevant month-start convention, the rule source, and the purpose for which dates are being used. That makes it possible to explain why a date appears and to update policy without confusing it with the underlying date arithmetic.

How to choose the calendar your application needs

  1. State the use case. Decide whether the application displays holidays, counts business days, represents an exchange schedule, or manages employee leave.
  2. Name the authority. Select the government, employer, bank, exchange, or other body whose calendar should control.
  3. Set the geographic scope. Identify the country and any subnational location that changes the applicable policy.
  4. Identify the rule and calendar conventions. Determine whether dates are fixed, weekday-based, shifted for weekends, formula-based, or combined; specify the calendar system and, if relevant, the authority for lunar month starts.
  5. Implement date calculation separately from observance. Use an appropriate date-only representation for date rules, then apply the chosen organization’s explicit policy to decide what the application should mark or treat as closed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.