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
kalakala 

Age Calculation

How to Calculate in the Age in the salesforce year including months and days..

rohitsfdcrohitsfdc

Use this formula

IF(
	NOT(ISNULL(BirthDate)), /* Condition */
	TEXT(FLOOR((TODAY()-BirthDate)/365.2425)) & " year(s) " & 
	TEXT(FLOOR(MOD((TODAY()-BirthDate),365.2425)/30)) & " month(s)", /* Value IF True */
	"" /* Value IF False */
)

 

craigmhcraigmh

It's very easy using the daysBetween and monthsBetween methods:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_date.htm

 

You'll probably have to use the Math.mod and Math.floor methods as well.