Skip to main content
New Participant
Oct 19, 2022 4:16 PM UTC
Question

Can Someone please help me Calculate Year and months

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
Oct 19, 2022 4:32 PM UTC

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
New Participant
Oct 19, 2022 4:37 PM UTC

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
Oct 19, 2022 4:38 PM UTC

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