MaterialDateTimePicker icon indicating copy to clipboard operation
MaterialDateTimePicker copied to clipboard

new feature - add possibility to select date and time

Open Rainer-Lang opened this issue 8 years ago • 9 comments

Add possibility to switch from date picker to time picker and back to select both date and time.

Rainer-Lang avatar Nov 06 '15 19:11 Rainer-Lang

Someone proposed to create a PR for this, so it might happen soonish

wdullaer avatar Nov 11 '15 11:11 wdullaer

Wow - that would be really awesome because I need a datetimepicker in one picker.

Rainer-Lang avatar Nov 11 '15 13:11 Rainer-Lang

+1 would be great if I can select both date and time together in one dialog

silviahisham avatar Mar 12 '16 00:03 silviahisham

please have look into this may be get some idea from this http://stackoverflow.com/a/22626706/1293313

milaptank avatar Mar 12 '16 11:03 milaptank

This is in the pipeline. I'm not pinning myself down on any dates (life's been extremely busy lately), but you should see some code appear in a branch soonish.

wdullaer avatar Mar 14 '16 16:03 wdullaer

Great - thanks for the update.

Rainer-Lang avatar Mar 14 '16 16:03 Rainer-Lang

Any update on this?

mikemike396 avatar Feb 12 '17 23:02 mikemike396

Still no ETA. If you need this in the short term, you will most likely have to do it yourself.

wdullaer avatar Feb 17 '17 10:02 wdullaer

This should work. I did it on button click event.

int yr, mon, date, hr, min, sec;

DatePickerDialog dpd = DatePickerDialog.newInstance(
        new OnDateSetListener() {
            @Override
            public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
                yr = year;
                mon = monthOfYear;
                date = dayOfMonth;

                TimePickerDialog tpd = TimePickerDialog.newInstance(
                        new OnTimeSetListener() {
                            @Override
                            public void onTimeSet(TimePickerDialog view, int hourOfDay, int minute, int second) {
                                hr = hourOfDay;
                                min = minute;
                                sec = second;
                            }
                        },
                        false
                );

                tpd.show(getSupportFragmentManager(), "TimePickerDialog");
            }
        }
);

dpd.show(getSupportFragmentManager(), "DatePickerDialog");

gnongsiej avatar Jan 16 '22 17:01 gnongsiej