Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if a date is more than 18 years javascript

function isOverEighteen(year, month, day) {
  var now = parseInt(new Date().toISOString().slice(0, 10).replace(/-/g, ''));
  var dob = year * 10000 + month * 100 + day * 1; // Coerces strings to integers

  return now - dob > 180000;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #date #years #javascript
ADD COMMENT
Topic
Name
7+8 =