How to calculate years and months from months field?

Avatar

Avatar
Level 1
B_ease_zee
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile

Avatar
Level 1
B_ease_zee
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile
B_ease_zee
Level 1

09-10-2018

Hi,

I am not too familiar with creating calculated fields in LiveCycle. I am look for assistance with creating a formula in FormCalc or Javascript to calculate the number of months entered in one field to years and months in another field. Any assistance would be greatly appreciatedd. Resources are welcomed as well. Thank you.

Example:

Months Entered: 38

Desired Calculated Field: 3yrs 2mos.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

10-10-2018

This drove me a bit nuts until I found the solution. I hope this works for you

var months = 38 //You can replace this with an input value

this.rawValue = (months / 12 | 0) + " years and " + months % 12 +" months"

Answers (0)