Age

Older than

Providing a date as birthday, validates if the age is larger than the specific integer

SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd");
Date birthday1 = ft.parse("2020-05-01");
v.val(birthday1, "older than 18"); // false

Date birthday2 = ft.parse("1980-05-01");
v.val(birthday2, "older than 18"); // true

RebbValhas a functiondate()to parse string to Date

v.val(v.date("1980-12-01"), "older than 21"); // true

Younger than

SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd");
Date birthday = ft.parse("2020-05-01");
v.val(birthday, "younger than 18"); // true

v.val(v.date("1980-05-01", "younge than 18"); // false

Last updated

Was this helpful?