<DatePicker
android:id="@+id/mydatapicker"
android:layout_width="match_parent"
android:layout_height="match_parent"></DatePicker>
mydata= (DatePicker) findViewById(R.id.mydatapicker);
mydata.getYear();
mydata.getMonth();
mydata.getDayOfMonth();
<TimePicker
android:id="@+id/mytimer"
android:layout_width="match_parent"
android:layout_height="match_parent">
</TimePicker>
mytime= (TimePicker)findViewById(R.id.mytimer);
mytime.getCurrentHour();
mytime.getCurrentMinute();