我有一个datetimepicker,用于获取日期并在屏幕上将其设置为标签。现在我想检查输入的日期是否有效。即,输入的日期应大于或等于当前日期。请告诉我们一个代码。谢谢
StringBuffer dateStrDate = new StringBuffer();
Calendar Cal = datePickerDate.getDateTime();
Calendar Cal = datePickerDate.getDateTime();
答案 0 :(得分:2)
DateTimePicker datePicker = DateTimePicker.createInstance(Calendar.getInstance(), "yyyy-MM-dd", null);
if(datePicker.doModal()) {
Calendar cal = datePicker.getDateTime();
int month=cal.get(cal.MONTH);
int year=cal.get(cal.YEAR);
int date1=cal.get(cal.DATE);
}