How to Compare two date of birth in Android [duplicate]
How to Compare two date of birth in Android [duplicate] This question already has an answer here: I have two edit texts first one is date of birth(datepicker) second one is till today(datepicker). In that I want to compare both the date of birth. and I have one button named as Save when the two date of births are 18 years old or above then only it shows the toast msg saved successfully otherwise it shows Age must be 18 or above I hope you understand the question. Thank you advance. This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. What have you tried so far? You can cast the result of the datepickers to a Date object and simply subtract them, check if it returns at least 18 years and you're good to go – Laurens Jul 2 at 6:24 ...