You need to sign in to do that
Don't have an account?
Srinivas Reddy Annadi 23
Calculate the age by using DOB is more than 2 years is not working properly
When I calculate the age by using DOB and it's not working properly.If I enter date 8/14/2017 and compare age is more than 2 years and condition is not satisfying because i will devide the days with 365.2425 and it showing as result 1.998672115 but I need more than two years for the date i entered because 8/14/2019 to 8/14/2019 is more than 2 years .I calculate the above date as
public static Boolean above2Years(Date dateOfBirth) {
Decimal totaldays=
dateOfBirth != null ? dateOfBirth.daysBetween(system.today()) : 0;
return (totaldays/365.2425) > 2 ? true : false;
}
Can you please help on this one
public static Boolean above2Years(Date dateOfBirth) {
Decimal totaldays=
dateOfBirth != null ? dateOfBirth.daysBetween(system.today()) : 0;
return (totaldays/365.2425) > 2 ? true : false;
}
Can you please help on this one
Try this:
Regards,
MKR
All Answers
Try this:
Regards,
MKR