Service Period Calculator - Years, Months and Days of Service
Enter the first and last day of a job to see the exact length of service in years, months and days, the total days and the number of completed years.
Maintained by Hirantha Sandaruwan Lakshan. Rules checked 13 October 2026 against Payment of Gratuity Act, No. 12 of 1983 and one more source.
About this tool
It also shows the date you reach five completed years, the service the Payment of Gratuity Act, No. 12 of 1983 asks for. The method is stated below, month ends are handled, and the dates stay in your browser.
How it works
The method counts whole months from the start date, keeping the same day of the month. The years are those months divided by 12, rounded down, and the months are the remainder. The days are what is left between that date and the end. Every step is calendar arithmetic on whole days, so no time zone or daylight saving can move a date.
By default the last day counts as a day of service. If your last day worked is 30 September, the period runs to the end of that day, which is the same as counting to 1 October. This is how the gratuity calculator counts. Turn it off to get the plain time between the two dates, one day shorter.
Month ends need a rule, and this is it: if the month has no day matching the start day (31 in a 30-day month, or 29 to 31 in February), that month is complete on the first day of the next month. So with the last day counted, 31 January to 28 February is exactly one month. A start on 29 February has its yearly anniversary on 1 March in a year with no 29 February, which is also how the gratuity calculator counts completed years, and the tests check that the two agree.
Completed years matter for gratuity. The Payment of Gratuity Act, No. 12 of 1983 gives a gratuity to a workman with at least five completed years of service when the employer has employed fifteen or more workmen on any day in the twelve months before the service ended, and it counts a year as a completed period of twelve months. A part year does not count. Probation, notice, service awards and pensions follow your employer's rules or your contract, and this page does not state any of them.
Worked examples
15 March 2018 to 30 September 2026, last day counted
That is 8 years, 6 months and 16 days: 15 March 2018 plus 102 months is 15 September 2026, and from there to the end of 30 September is 16 days. The total is 3,122 days, and the completed years are 8.
1 March 2020 to 28 February 2025
Exactly 5 years, 0 months and 0 days, which is 1,826 days. This is the first day that completes five years. One day earlier, 27 February 2025, is 4 years, 11 months and 27 days, so the fifth year is not yet complete.
31 January to 28 February 2026
With the last day counted this is exactly one month (29 days). Without it, it is 0 months and 28 days, because February has no 31st and the month only completes on 1 March.
How edge dates are counted
| Start | End | Last day counted | Result |
|---|---|---|---|
| 15 March 2018 | 30 September 2026 | Yes | 8 years, 6 months, 16 days (3,122 days) |
| 15 March 2018 | 30 September 2026 | No | 8 years, 6 months, 15 days (3,121 days) |
| 1 March 2020 | 28 February 2025 | Yes | 5 years, 0 months, 0 days (1,826 days) |
| 1 March 2020 | 27 February 2025 | Yes | 4 years, 11 months, 27 days |
| 31 January 2026 | 28 February 2026 | Yes | 0 years, 1 month, 0 days (29 days) |
| 31 January 2026 | 28 February 2026 | No | 0 years, 0 months, 28 days |
| 29 February 2020 | 28 February 2021 | Yes | 1 year, 0 months, 0 days |
| 29 February 2020 | 27 February 2021 | Yes | 0 years, 11 months, 30 days |
Frequently asked questions
How do I calculate years, months and days between two dates?
Count whole months from the start date, keeping the same day of the month. Years are those months divided by 12, the months are the remainder, and the days are what is left up to the end date. This tool does it for you and shows the total days as a check.
Does the last day count as a day of service?
By default yes: a person who works 1 March to 28 February has served every one of those days. That is how the gratuity calculator counts, so the two agree. Choose No to get the plain time between the two dates, which is one day shorter.
How many years of service do I need for gratuity?
At least five completed years under the Payment of Gratuity Act, No. 12 of 1983, with an employer who has employed fifteen or more workmen on any day in the twelve months before the service ended. The tool shows the date you reach five completed years. Use the gratuity calculator for the amount.
What happens if the end date is before the start date?
The tool shows a message instead of a result and offers a button to swap the two dates. It does not guess which one you meant.
How are month ends such as 31 January handled?
If the month has no day matching the start day, the month is complete on the first day of the next month. So with the last day counted, 31 January to 28 February is one month, and without it the same dates are 28 days. The table above shows more cases.
Is a part year counted as a year?
No. Completed years are whole years only, so 4 years and 11 months is 4 completed years. The Gratuity Act counts a year as a completed period of twelve months.
Does the calculator subtract unpaid leave or a break in service?
No. It measures calendar time between the two dates. If you had a break that your employer does not count, measure each stretch of service separately, and check your contract or ask the Department of Labour how the break is treated.
Sources & references
Updated Oct 13, 2026