After using this function, I searched the internet and added only a few minutes to the current time, but not any time, so I wrote a sharing.
String starttime="08:30";int gap = 20;String newtime = addMin(starttime,gap);
/*** The time (HH: Mm) provided by the root queue and the time interval between which a new time is returned ** arg1: initial time * arg2: ** return: returns the new time **/public static string addmin (string time, int gap) {try {string [] S = time. split (":"); int min = integer. parseint (s [1]) + gap % 60; int hour = integer. parseint (s [0]) + (GAP/60); If (min> = 60) {hour + = 1; Min-= 60;} If (hour> = 24) {hour = hour % 24;} return ("0" + hour ). substring ("0" + hour ). length ()-2, ("0" + hour ). length () ) + ":" + ("0" + min ). substring ("0" + min ). length ()-2, ("0" + min ). length ();} catch (exception e) {system. out. println ("addmin error! "+ E. tostring (); Return "";}}
// 100 results 08: 3008: 5009: 1009: 3009: 5010: 1010: 3010: 5011: 1011: 3011: 5012: 1012: 3012: 5013: 1013: 3013: 5014: 1014: 3014: 5015: 1015: 3015: 5016: 1016: 3016: 5017: 1017: 3017: 5018: 1018: 3018: 5019: 1019: 3019: 5020: 1020: 3020: 5021: 1021: 3021: 5022: 1022: 3022: 5023: 1023: 3023: 5000: 1000: 3000: 5001: 1001: 3001: 5002: 1002: 3002: 5003: 1003: 3003: 5004: 1004: 3004: 5005: 1005: 3005: 5006: 1006: 3006: 5007: 1007: 3007: 5008: 1008: 3008: 5009: 1009: 3009: 5010: 1010: 3010: 5011: 1011: 3011: 5012: 1012: 3012: 5013: 1013: 3013: 5014: 1014: 3014: 5015: 1015: 3015: 5016: 1016: 3016: 5017: 1017: 30