I’m getting a string from the database and converting it into a time, eg 12:19, and then I’m adding it to the timepicker. The problem is it’s taking the time and date and I cant seem to get rid of the date part. My code is below
public static final String TIME_FORMAT = "kk:mm";
String StartTime = reminder.getString(reminder.getColumnIndexOrThrow(DatabaseStore.START_TIME));
SimpleDateFormat dateTimeFormat = new SimpleDateFormat(TIME_FORMAT);
startTime = dateTimeFormat.parse(StartTime);
addTimeTopicker.setTime(startTime);
You have bad pattern, you can’t use kk.
So you can use these approaches:
Have look at SimpleDateFormat patterns