Import datePicker of your class:
import android.widget.DatePicker;
Declare the variable:
private DatePicker
dPicker;
Write the code in the button click event:
Integer gYear = dPicker.getYear();
Integer gMonth = dPicker.getMonth()+1;
Integer gDate = dPicker.getDayOfMonth();
StringBuilder sb=new StringBuilder();
sb.append(gYear .toString()).append("-").append(gMonth.toString()).append("-")
.append(gDate.toString());
String dPStr=sb.toString();
No comments:
Post a Comment