Tuesday, November 6, 2018

Display an Employee's Age in Years, Months and Days

The steps below show how to create a custom entity field that computes for an employee's age in year(s), month(s) and day(s):

Birth Date: 4/12/1987
Custom Field Value: 25 Years 9 Months 26 Days (as of 2/4/2013)

1. Navigate to Customization > Lists, Records, & Fields Entity Fields > New.

2. Enter the LABEL: Age

3. Set:

TYPE= Free-Form Text


4. Under Applies To tab, mark the Employee check box.

5. Under Display tab, set Subtab to Human Resources.

6. Under Validation & Defaulting tab, insert the formula below in the Default Value field:

FLOOR(ROUND((({today} - {birthdate})/365.2425),2))||(' ')||('Years ')||FLOOR(ROUND((((ROUND((({today} - {birthdate})/365.2425),3))-FLOOR(ROUND((({today} - {birthdate})/365.2425),3)))*12),3))||(' ')||('Months ')||FLOOR(ROUND(((ROUND((((ROUND((({today} - {birthdate})/365.2425),4))-FLOOR(ROUND((({today} - {birthdate})/365.2425),4)))*12),4)-FLOOR(ROUND((((ROUND((({today} - {birthdate})/365.2425),4))-FLOOR(ROUND((({today} - {birthdate})/365.2425),4)))*12),4)))*31),4))||(' ')||('Days')


7. Click Save.

No comments:

Post a Comment