Age Calculator Sri Lanka — Exact Years, Months, Days
Find your precise age between any two dates — broken down into years, months, days, hours, minutes, and seconds. Includes Sri Lanka–specific milestones: NIC eligibility at 16, voting age at 18, driving licence age, Grade 1 school cut-off, and passport validity check. Live seconds counter, leap-year accurate, runs in your browser.
How it works
The calculator uses the standard calendar-borrowingrule — the same one date-fns' differenceInCalendarMonths family of helpers implements, and the same one mainstream age sites (calculator.net, timeanddate.com) use. It produces an answer that always reconciles: adding the years, months, and days back to your birth date returns the reference date to the day.
Given a birth date B and a reference date R:
- Compute raw differences for each field:
ΔY = R.year − B.year,ΔM = R.month − B.month,ΔD = R.day − B.day, and the same for hours, minutes, seconds. - If seconds < 0, borrow 60 seconds from minutes. If minutes < 0, borrow 60 from hours. If hours < 0, borrow 24 from days.
- If days < 0, borrow the number of days in the calendar month immediately before the reference month — that's real month-aware borrowing, not a 30-day approximation. So if
Ris in March, you borrow 28 or 29 (Feb), not 30. - If months < 0, borrow 12 from years.
The total counters (months, weeks, days, hours, minutes, seconds) are computed independently from the raw millisecond difference R.time − B.time, divided by the right constant. Total months is years × 12 + months from the calendar breakdown — using whole calendar months, not 30-day buckets.
For leap-day birthdays (Feb 29), the next-birthday section uses the common-law convention of rolling to Feb 28 in non-leap years — which is also the practice followed by the Sri Lanka Registrar General's Department when issuing age-dependent documents. The Gregorian leap-year rule applied is the full one: divisible by 4, except centuries unless divisible by 400.
To guard against single-algorithm bugs, the years figure is cross-checked against an independent year-only algorithm that compares (month, day, time) tuples directly. The two algorithms must agree before the "cross-checked" badge appears in the calculator header.
Worked examples
Sri Lanka age milestones
In Sri Lanka several key rights, licences, and services are tied to exact age thresholds. Use the calculator above to verify whether you (or a family member) have reached these milestones, or to find out exactly how many months remain until you do.
| Milestone | Age | Authority |
|---|---|---|
| Grade 1 school admission | 5 yrs | Ministry of Education (5–5y 11m on 1 Jan) |
| NIC (National Identity Card) eligibility | 16 yrs | Dept. of Registration of Persons |
| Driving licence — motorcycle / car / three-wheeler | 18 yrs | Dept. of Motor Traffic |
| Voting age | 18 yrs | Constitution Art. 88; Election Commission |
| Minimum age to stand for Parliament | 18 yrs | Constitution Art. 91 |
| Driving licence — heavy vehicles (lorry, bus) | 21 yrs | Dept. of Motor Traffic |
| EPF early withdrawal (women) | 55 yrs | Employees' Provident Fund Board |
| EPF early withdrawal (men) / public-sector retirement | 60 yrs | EPF Board / Pensions Dept. |
| University academics / judges (retirement) | 65 yrs | University Grants Commission / Constitution |
Passport validity: adult passports (age 16+) are valid for 10 years; passports for persons under 16 are valid for 5 years. Sri Lanka passport photos must show the applicant with a neutral expression against a white background (size: 35 × 45 mm).
Frequently asked questions
Sources & references
- ECMA-262 — JavaScript Date object specification
- Gregorian calendar — leap year rules (Wikipedia)
- ISO 8601 — duration format (PnYnMnDTnHnMnS)
- date-fns — differenceInCalendar* reference implementation
Algorithm and worked examples last cross-checked on 2026-05-11. The Gregorian leap-year and calendar-borrowing logic don't change, so this page is reviewed annually rather than on a fixed schedule.
Related tools
Comments & feedback
Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.
Found a bug, edge case, or want to suggest an improvement?
Email me at [email protected] — most fixes ship within 24 hours.