由于日期格式错误导致请求中出现500错误

时间:2018-02-06 10:43:10

标签: android android-studio android-calendar android-datepicker android-json

由于错误的日期格式,我通过Datepicker对话框收到500服务器错误。它编译成:" 将dob中的日志作为键" 而不是 2011年11月17日。如何解决。 这是我在OnCreate中的代码:

final Calendar myCalendar = Calendar.getInstance();

final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {

    @Override
    public void onDateSet(DatePicker view, int year, int monthOfYear,
                              int dayOfMonth) {
        // TODO Auto-generated method stub
        myCalendar.set(Calendar.YEAR, year);
        myCalendar.set(Calendar.MONTH, monthOfYear);
        myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
        int month=monthOfYear+1;
        dob.setText(dayOfMonth+"/"+month+"/"+year);
    }
};

findViewById(R.id.prof_set_dob).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        new DatePickerDialog(SignupActivity.this, date, myCalendar.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show();
        }
    });
}

这是日志:

02-06 15:58:38.842 18576-18576/finlit.finlit E/Ff:  $$$$$$$$$$$$$$$ {"name":"quack","email":"shubhamsaini990@gmail.com","gender":"M","monthly_salary":"2300000","mobile_no":"6978090946","password":"test","dob":"17\/11\/2011"}

02-06 15:58:40.276 18576-20911 / finlit.finlit E / Volley:[3488] BasicNetwork.performRequest:意外的响应代码500

0 个答案:

没有答案