Skip to main content
October 19, 2022
Question

Can Someone please help me Calculate Year and months

  • October 19, 2022
  • 4 replies
  • 0 views

The input should come from the date field and the output should include the year and the months in decimal. for example: Input 03/05/2016  the output: 6,5.

.

value: if(
                    a!isNullOrEmpty(ri!dealerBusiness.dateOrganized),
                    null,
                    /*calculate the age of the person*/
                    int(right(today(), 4)) - (
                      right(ri!dealerBusiness.dateOrganized, 4)
                    )
                  ),

This what I have so far.

4 replies

mikes0011
Brainy
October 19, 2022

I don't understand what you mean "in decimal"?  Could you give a little more detail as to what exaclty your data inputs are, what the corresponding output should be, and why?

If you just want a read-out of the elapsed years, elapsed months: check out the "elapsedmonths" function in the Date and Time Utilities plug-in.

The Expression Guru
October 19, 2022

Hi Mike,

I have to calculate a company years in business and the requirements are " The field should calculate based on year formed and may be decimal Ex: 31.2

so if the business is being open for 1 year and 6 months I should get  01,06

mikes0011
Brainy
October 19, 2022

gotcha.  please use the aforementioned plug-in; you should be able to make use of elapsedYears() and elapsedMonths() to satisfy this requirement, i expect.

The Expression Guru