[Solved] Time shift in time format as input, the shifted real time as output [closed]


You will probably want some thing like the Calendar for the time addition. Example:

Calendar future = Calendar.getInstance();
future.add(Calendar.HOUR_OF_DAY, enteredHour);
future.add(Calendar.MINUTE, enteredMinute);
future.add(Calendar.SECOND, enteredSecond);
//And so on...
//Now the calendar instance 'future' holds the current time plus the added values.

As for entering the time, one possibility is to enter it as a text, and then use a DateFormatter to get a Date from it. Example:

SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Date enteredDate = sdf.parse(string); //String can be the input from an edit-text for example.
//You can now get the hours/minutes/seconds from the date with any of the Dates get-methods.

solved Time shift in time format as input, the shifted real time as output [closed]