I have a date and time in my application, and I just noticed that the time is wrong. the current time that the timer displays is an hour delay, and its am / pm is not the same as, for example, the current time 2:55 pmit will show 1:55 amwhat appears to be a problem, this is the code
UPDATE: DATE AND TIME PICKER
@Override
public void onClick(View v) {
if (v == btnCalendar) {
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DATE)+1;
DatePickerDialog dpd = new DatePickerDialog(this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
txtDate.setText(dayOfMonth + "-"
+ (monthOfYear + 1) + "-" + year);
}
}, mYear, mMonth, mDay);
dpd.show();
}
if (v == btnTimePicker) {
final Calendar c = Calendar.getInstance();
mHour = c.get(Calendar.HOUR)+1;
mMinute = c.get(Calendar.MINUTE);
TimePickerDialog tpd = new TimePickerDialog(this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
txtTime.setText(hourOfDay + ":" + minute);
}
}, mHour, mMinute, false);
tpd.show();
}
}
}
UPDATE: what I did was put +1 in mHour = c.get(Calendar.HOUR_OF_DAY)+1;, maybe there are any ideas on this method?
unixed - AM / PM button is incorrect, it always shows am at the beginning
UPDATE: AM / PM does not start with am completely wrong, because now that its morning shows pm, but at pm it shows am
UPDATE: there is also a problem in date.What have I done to put +1 in mDay = c.get(Calendar.DATE)+1;maybe set back on this method any ideas?