function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vishal1vishal1 

Doubt

hi,

i have to create one date field and then i have to calculate the age from the date of datefield to today which rule can i have to apply please inform to me

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

Create a date type formula field and try the below formula.

 

IF(MONTH(TODAY())>MONTH(date),YEAR(TODAY())-YEAR(date),IF(AND(MONTH(TODAY())=MONTH(date),DAY(TODAY())>=DAY(date)),YEAR(TODAY())-YEAR(date),(YEAR(TODAY())-YEAR(date))-1))

 

Here "date" is a custom date field.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.