Reputation: 23
I am using Date picker.
How do we check if today and the past date cannot be selected?
In php, we can compare using strtotime(now)
and selected date and deduce whether it's past date or not.
Is it possible to do on Android?
Upvotes: 1
Views: 1601
Reputation: 43108
After you have obtained the value just do:
Date fromPicker = // get the value here;
Date now = new Date();
if (fromPicker.before(now)) {
// error !
}
Upvotes: 2