Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get long timestamp from date picker onDateSet

@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
        int dayOfMonth) {

    dateET.setText(dayOfMonth + "/" + monthOfYear + "/" + year);
}

I want to avoid user setting date past to current date.

So, is there a way i can get the long timestamp (may be 12:00 A.M of the date set), so that i can compare it with the current timestamp and if it is less, the date will be set to default(current date + 3 days).

Thank You

like image 471
Archie.bpgc Avatar asked Feb 11 '13 09:02

Archie.bpgc


1 Answers

You have to do it yourself:

Calendar calendar = new GregorianCalendar(year, monthOfYear, dayOfMonth);
calendar.getTimeInMillis();
like image 188
faceman Avatar answered Oct 12 '22 01:10

faceman