Skip to main content
Question

How to calculate the number of years between two dates?

  • January 14, 2016
  • 0 replies
  • 307 views

I have a date field to indicate an employee's start date called "Empl Svc Dt". The field is used to determine the number of years an employee has been employed. Does anyone know the best way to calculate the number of year(s) as a single number  "0, 1, 2" etc. between the current date and "Empl Svc Dt"?

This topic has been closed for replies.

  • Registered
  • January 14, 2016
Round Down

Int(Today() - Year([Empl Svc Dt]))

Round Up

Int(Today() - Year([Empl Svc Dt]) + 1)

Try this.  i suspect that Dan's formula will not work

This formula was for Age, but I changed it to be used for completed years of service.


var date EST = [
Empl Svc Dt];

Year(Today())-Year($EST)
-
If(
Month(Today())<Month($EST)
or
(Month(Today())=Month($EST) and Day(Today())<Day($EST)),1,0)

  • Registered
  • January 14, 2016
> ... Dan's formula will not work

CORRECTED:

Round Down
Int(Year(Today()) - Year([Empl Svc Dt]))

Round Up
Int(Year(Today()) - Year([Empl Svc Dt]) + 1)

Perfect! Thank you,

Dan,
So if they hire me on December 30th and the Vacation Policy is that I get 2 weeks vacation after 1 complete year of service, then on January 2nd, 3 days later, the your formula says I get my 2 weeks vacation.  Sweet.  I'd like to work for that Company.

  • Registered
  • January 15, 2016
Yeah I am very liberal in that regard. Also you should be implementing your own 20% program to work on whatever you want irrespective of whether or not you company has a 20% program. Slack off.