Forum Discussion

EricRovner's avatar
EricRovner
Qrew Member
3 years ago

Convert Duration in Days to Years

I am trying to calculate length of employment for our employees. I've been "successful" in being able to generate two fields - one for # of years and once for # of months. But, what I really need is a single field that shows # of years with a decimal point.

​I've used the formula (Today() - [Hire Date])/365 - yielding an adequate result for my needs (# of years with a decimal point) but it is labeled as days not years. (2/25/2022 - 12/15/2017)/365 = 4.2 days

Any assistance would be greatly appreciated as this is driving me nuts and I couldn't find a clear resolution for this topic within the community posts.​

Thanks!​

------------------------------
Eric Rovner
------------------------------

7 Replies

  • Try this

    Change the field type to formula numeric

    Todays(Today() - [Hire Date])/ 365

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • EricRovner's avatar
      EricRovner
      Qrew Member
      Thanks so much Mark - just what the doctor ordered - super appreciate the quick assist!

      ------------------------------
      Eric Rovner
      ------------------------------
    • EricRovner's avatar
      EricRovner
      Qrew Member
      I apologize for having to come back to the well but I now have a related challenge. I'm able to calculate an employee's tenure in years with the numeric formula "Todays(Today() - [Hire Date])/ 365" but now I need to calculate the # of years with a decimal point for the amount of time between an employee's hire date and the static date they were reviewed.

      I've tried using the numeric formula ([Review Date] - [Hire Date])/365 but I receive an error message stating; "The expression ([Employee - Hire Date]) on the left hand side of the operator "/" is of type date while the expression 365 on the right hand side is of type number. The operator "/" cannot be used with these types of expressions."

      I'd sure appreciate any guidance toward a formula solution!

      Thanks in advance,  -Eric


      ------------------------------
      Eric Rovner
      ------------------------------
      • JeffPeterson1's avatar
        JeffPeterson1
        Qrew Captain
        Try it like this:

        ToNumber(Todays(Today() - [Hire Date]))/ 365


        ------------------------------
        Jeff Peterson
        ------------------------------