Replies: 1
Trying to build an age calculation. I want to show “Abdur Rahim is 25 years old now in October 2023. To be more specific, he is 25 years, 7 months, & 0 days old today, and his next birthday is in 5 months and 0 days from today.”
So far I have built, “Abdur Rahim is 25 years old now at [need the current month and year here]. To be more specific, he is 25 years, 7 months, & 0 days old today. [need to subtract from the next birth date and get how many months or day remains.]”
My codes so far.
Age Calculation:
(function(){
var o = DATEDIFF(NOW(), fieldname1, ‘dd-mm-yyyy’, ‘y’);
return o[‘years’]+’ years old ‘;
jQuery(‘#calculation-yashesaplama’).html(yashesaplama);
return yashesaplama;
})()
Age, Month, Dates Calculation:
(function(){
var o = DATEDIFF(NOW(), fieldname1, ‘dd-mm-yyyy’, ‘y’);
return o[‘years’]+’ years, ‘+ o[‘months’]+’ months, & ‘+ o[‘days’]+’ days old’;
jQuery(‘#calculation-yashesaplama’).html(yashesaplama);
return yashesaplama;
})()
Output with summary field: <p><b>Abdur Rahim</b> is <b data-cff-field="fieldname3"></b> now at <span data-cff-field="fieldname6"></span>. To be more specific, he is <b data-cff-field="fieldname4"></b> today.</p>screenshot of how it is now.
So can you help me, how can I get the current year? and is it possible to subtract the remaining months and days for the next birthday? if it is, how?
asked a lot of questions. sorry for troubling you. I appreciate your effort. thanks.
