Age from DOB

Dharmeshdhabu

New member
I have php programme for hospital managment. I calculate age from DOB. I wants to add "Yr" after age calculation. Please guide me how to add "Yr" after calculation. Below is my code.
Code:
var dob11 = new Date(document.getElementById('Age1').value);
 
what the document.getElementById('Age1').value contains? is a age like "30"?
you can do this:
Code:
var age = document.getElementById('Age1').value;
const ageString = age + 'Yr';
or
Code:
var age = document.getElementById('Age1').value;
const ageString = `${age}Yr`;
 
Back
Top