How to Calculate Years of Service
By WorkCalc Team · August 10, 2026
HR teams track years of service for all kinds of reasons: vesting schedules, vacation accrual tiers, service awards, and simple recognition on a work anniversary. The calculation feels like it should be trivial, but the details around partial years and the exact anniversary date trip people up more often than you’d expect. Here’s the method, stripped down to its parts.
The core concept
Calculating years of service from a start date works exactly like calculating someone’s age from a birthdate. You’re not subtracting one calendar year from another; you’re comparing the month and day of the start date against the month and day of today to see whether the “anniversary” for this year has already happened.
If today’s month and day fall on or after the start date’s month and day, the anniversary for the current year has already been reached, so it counts. If today’s month and day fall before the start date’s month and day, the current year hasn’t finished yet, so the count needs to be reduced by one to reflect only completed years.
That single comparison, month and day only, independent of the year, is the whole trick. Everything else is bookkeeping around it: finding the next anniversary date and counting the days until it arrives.
The method
completedYears = today.year - startDate.year
if today.month > startDate.month:
anniversaryReachedThisYear = true
else if today.month == startDate.month and today.day >= startDate.day:
anniversaryReachedThisYear = true
else:
anniversaryReachedThisYear = false
if not anniversaryReachedThisYear:
completedYears = completedYears - 1
nextAnniversaryYear = startDate.year + completedYears + 1
nextAnniversaryDate = date(nextAnniversaryYear, startDate.month, startDate.day)
daysUntilNextAnniversary = nextAnniversaryDate - today
Because this depends on “today,” the actual number changes every day. The method above is what stays constant. Run it with today’s real date and you’ll always get the current, accurate answer.
Worked example 1
Say an employee started on August 10, 2016, and you’re calculating this as of August 10, 2026.
- Raw year difference: 2026 minus 2016 = 10.
- Is today’s month and day (August 10) on or after the start date’s month and day (August 10)? Yes, they match exactly, so the anniversary for this year has been reached.
- Completed years: 10, no adjustment needed.
- Next anniversary: since this year’s anniversary already landed today, the next one is a year further out: August 10, 2027.
- Days until next anniversary: 365 days from August 10, 2026 to August 10, 2027.
Result: 10 years of service, with the next anniversary 365 days away.
Worked example 2
Now say an employee started on November 1, 2023, and you’re calculating this as of August 10, 2026.
- Raw year difference: 2026 minus 2023 = 3.
- Is today’s month and day (August 10) on or after the start date’s month and day (November 1)? No, August comes before November, so this year’s anniversary hasn’t happened yet.
- Completed years: 3 minus 1 = 2.
- Next anniversary: the upcoming one is later this same year, November 1, 2026.
- Days until next anniversary: 83 days from August 10, 2026 to November 1, 2026.
Result: 2 years of service, with the next anniversary 83 days away.
Notice the shape of the two examples: when today’s month and day sit on or after the anniversary, the current calendar year already counts and the next anniversary is in the following year. When today’s month and day sit before the anniversary, the current calendar year doesn’t count yet and the next anniversary is later this same year.
Edge cases and nuances
Exactly on the anniversary date. If today is the precise anniversary of the start date, it counts as reached. That day is included in the completed-years total, and the “next anniversary” shown is a full year further out, since the one happening right now isn’t upcoming anymore, it’s current.
Leap years. The days-until-next-anniversary figure is a true calendar day count between two dates, so it automatically absorbs any February 29 that falls inside the window. You don’t need a separate leap-year rule; counting actual days between two real calendar dates handles it for you. The one place leap years get slightly tricky is a start date of February 29 itself: in a non-leap year, that anniversary has to fall back to either February 28 or March 1, depending on which convention you pick. Most payroll and HR systems use February 28 as the substitute date in non-leap years.
Time zones and “today.” Because this calculation hinges on comparing dates, not timestamps, it should always run against a clean, time-stripped date (midnight local, or whichever time zone your organization treats as authoritative). Mixing in time-of-day components can shift the comparison by a day near midnight, which is an easy source of off-by-one bugs if you’re building this logic yourself rather than using a calculator that already handles it.
Future start dates. A start date that hasn’t happened yet isn’t a valid input for this calculation; years of service only makes sense for dates in the past or today.
FAQ
What happens if today is the exact anniversary date? It counts. The completed years total includes that anniversary as reached, and the next anniversary date shown moves one year further out, since the current one is happening today rather than being upcoming.
Does this method account for leap years? Yes. The days-until-next-anniversary figure is calculated as a real day count between two calendar dates, so it naturally reflects whether a February 29 falls somewhere in that window. No separate adjustment is needed.
Why does the answer change depending on when I run the calculation? Because the calculation always compares the start date against today’s date, and today keeps moving. The method itself (comparing month and day, then finding the next anniversary) never changes, only the specific numbers it produces as time passes.
Use the Work Anniversary Calculator to run your own numbers.