Every digital clock contains a small creature that has to advance the time every minute [citation needed]. Due to the popularty of digital clocks and the popularity of catching them in the wild, they are nearly extinct in nature which is why in this challenge we try to automate this task:
Given your string of a given time in the 24h format, the task is to advance this time by one minute.
Details
- Both the input and output must be strings.
- The time is given as a five character string.
- Both the hour and the minutes are given as a two digit number: if the number is below 10, there will be a leading zero.
- The two numbers are separated by a colon.
Examples
Input Output
00:00 00:01
00:02 00:03
05:55 05:56
09:59 10:00
12:49 12:50
20:05 20:06
23:59 00:00
-
25\$\begingroup\$ Congratulations on finding a challenge in which Excel beats Jelly! \$\endgroup\$ojdo– ojdo2021εΉ΄10ζ06ζ₯ 13:58:54 +00:00Commented Oct 6, 2021 at 13:58
-
2\$\begingroup\$ [citation needed] π€£ \$\endgroup\$Taco– Taco2021εΉ΄10ζ07ζ₯ 23:53:52 +00:00Commented Oct 7, 2021 at 23:53
-
4\$\begingroup\$ Ref: Pratchett. In Discworld, imps usually do that sort of thing. "Good Morning, Insert Name Here! I am the Dis-Organizer Mark Five, the GooseberryTM. How may Iβ" \$\endgroup\$roblogic– roblogic2021εΉ΄10ζ08ζ₯ 03:35:15 +00:00Commented Oct 8, 2021 at 3:35
52 Answers 52
Microsoft Excel, 9 bytes
=A1+"0:1"
Input is in cell A1.
Tested on my Mac (Excel for Mac version 16.53) and online at Office.com.
-
\$\begingroup\$ Great tool for the job :) To be a little nitpicky: If you input truly a string as required by the challenge (eg.
'23:59), you get a number in the cell with the formula. \$\endgroup\$pajonk– pajonk2021εΉ΄10ζ05ζ₯ 09:24:30 +00:00Commented Oct 5, 2021 at 9:24 -
\$\begingroup\$ Thanks. I just tried
'23:59on my Excel for Mac 16.53 and somehow it still works (00:00output)... Edit: it seems to work on Office.com, too... \$\endgroup\$Dominic van Essen– Dominic van Essen2021εΉ΄10ζ05ζ₯ 10:40:16 +00:00Commented Oct 5, 2021 at 10:40 -
\$\begingroup\$ @pajonk i.sstatic.net/SVFFr.png \$\endgroup\$Dominic van Essen– Dominic van Essen2021εΉ΄10ζ05ζ₯ 10:48:16 +00:00Commented Oct 5, 2021 at 10:48
-
\$\begingroup\$ @pajonk (after some trial-and-error) - It seems to depend on the order that the cells are created. I entered
23:59intoA1first, and then typed-in the 9-byte=A1+"0:1". After that, other inputs - including explicit strings like'12:30- produce the correct output. This seems to be because Excel automatically applied a custom date-like format to the formula cell (my cellA2). This doesn't necessarily happen if the cells are filled-in in a different order. Not sure whether (or how) this should be reflected somewhere in the byte-count... \$\endgroup\$Dominic van Essen– Dominic van Essen2021εΉ΄10ζ05ζ₯ 11:00:13 +00:00Commented Oct 5, 2021 at 11:00 -
1\$\begingroup\$ Also works in LibreOffice, but not in Google Sheets π \$\endgroup\$Paddy Landau– Paddy Landau2021εΉ΄10ζ15ζ₯ 07:35:02 +00:00Commented Oct 15, 2021 at 7:35
Bash + coreutils date, 17
date -d1γγ«+min +%R
This assumes everything is in UTC (such as how TIO appears to be set up). If this is not OK, then 4 bytes must be added:
Bash + coreutils date, 21
date -ud1γγ«UTC+min +%R
x86-16 machine code, (ει€) 61 (ει€γγγΎγ§) (ει€) 55 (ει€γγγΎγ§) 54 bytes
00000000: be82 008b fe8b d6ad 86c4 9346 56ad 86c4 ...........FV...
00000010: 4037 0430 3d30 367c 1293 4037 0430 3d34 @7.0=06|[email protected]=4
00000020: 327c 03b8 3030 86c4 abb0 305f 86c4 abb8 2|..00....0_....
00000030: 2409 aacd 21c3 $...!.
Listing:
BE 0082 MOV SI, 82H ; SI point to DOS command line tail
8B FE MOV DI, SI ; save pointer to beginning of string for later
8B D6 MOV DX, SI ; save pointer to beginning of string for output
AD LODSW ; load hours digits into AX
86 C4 XCHG AL, AH ; endian convert
93 XCHG AX, BX ; save hours in BX
46 INC SI ; skip colon
56 PUSH SI ; save string offset to minutes
AD LODSW ; load minutes digits into AX
86 C4 XCHG AL, AH ; endian convert
40 INC AX ; add one minute
37 AAA ; BCD Adjust After Addition!
04 30 ADD AL, '0' ; ASCII fix low digit
3D 3630 CMP AX, '60' ; is minutes wrap around?
7C 13 JL NO_CARRY_HOUR ; if not, skip hours
93 XCHG AX, BX ; move hours into AX
40 INC AX ; increment hours
37 AAA ; BCD Adjust After Addition!
04 30 ADD AL, '0' ; ASCII fix low digit
3D 3234 CMP AX, '24' ; rolled over to 24 hours?
7C 03 JL NO_CARRY_DAY ; if not, skip to convert
B8 3030 MOV AX, '00' ; reset hours to '00'
NO_CARRY_DAY:
86 C4 XCHG AL, AH ; endian convert
AB STOSW ; write hours string
B0 30 MOV AL, '0' ; reset minutes to '00'
NO_CARRY_HOUR:
5F POP DI ; minutes string offset to DI
86 C4 XCHG AL, AH ; endian convert
AB STOSW ; write minutes to output string
B8 0924 MOV AX, 0924H ; AL = '$', AH = write string function
AA STOSB ; write DOS string terminator to end of string
CD 21 INT 21H ; write output to console
C3 RET ; return to DOS
Thought it would be a more straightforward use of BCD operations, though it gave me a use for the AAA instruction so there's that.
Standalone DOS executable. Input via command line, output to console.
OR...
21 bytes if I could take I/O as a packed BCD hex word (12:59 == 0x1259), and get to use AAA's bastard step-sibling DAA!
40 INC AX ; increment the time
27 DAA ; decimal adjust packed BCD
3C 60 CMP AL, 60H ; did minutes reach 60?
7C 0E JL DONE ; if not, do nothing else
32 C0 XOR AL, AL ; otherwise, reset minutes to 0
86 E0 XCHG AH, AL ; swap hours and minutes in AL
40 INC AX ; increment the hours
27 DAA ; decimal adjust packed BCD
3C 24 CMP AL, 24H ; did hours reach 24?
86 E0 XCHG AH, AL ; real quick, swap hours and minutes back
7C 02 JL DONE ; if less than 24, do nothing else
32 E4 XOR AH, AH ; otherwise, reset hour to 0
DONE:
C3 RET
-
2\$\begingroup\$ I'm impressed. Apparently BCD still has a use, if only in code golf. \$\endgroup\$rosuav– rosuav2021εΉ΄10ζ08ζ₯ 04:15:23 +00:00Commented Oct 8, 2021 at 4:15
-
1\$\begingroup\$ @rosuav "
AAAandDAAare extremely useful x86 instructions." -no one ever \$\endgroup\$640KB– 640KB2021εΉ΄10ζ08ζ₯ 04:20:57 +00:00Commented Oct 8, 2021 at 4:20
-
\$\begingroup\$ Nice answer! On older PHP you can save 1 byte using a bit flipped string (
~"H:i") as a default constant instead of"H:i"but it's probably not worth the hassle! \$\endgroup\$Dom Hastings– Dom Hastings2021εΉ΄10ζ06ζ₯ 17:43:06 +00:00Commented Oct 6, 2021 at 17:43 -
1\$\begingroup\$ Could you elaborate on that, @DomHastings? Can't figure out how that'd work. \$\endgroup\$Shaggy– Shaggy2021εΉ΄10ζ14ζ₯ 23:15:46 +00:00Commented Oct 14, 2021 at 23:15
-
\$\begingroup\$ Of course! I probably didn't explain it very well! But basically
~"..."bitflips the string see this example from this answer, and the resulting high-byte string can be used as a bare word constant to save 1 byte on the quotes. But it does add extra faff to the answer! Hope that helps! \$\endgroup\$Dom Hastings– Dom Hastings2021εΉ΄10ζ15ζ₯ 07:33:48 +00:00Commented Oct 15, 2021 at 7:33
Python 2, 68 bytes
def f(s):v=int(s[:2])*60-~int(s[3:]);print'%02d:%02d'%(v/60%24,v%60)
Python 3.8, (ει€) 65 (ει€γγγΎγ§) 64 bytes
-1 byte thanks to @Matthew Willcockson
lambda s:f"{(v:=int(s[:2])*60-~int(s[3:]))//60%24:02}:{v%60:02}"
-
1\$\begingroup\$ What's amazing is a more normal script version is less than 50 characters longer:
import datetime as d,sys;f="%H:%M";print((d.datetime.strptime(sys.argv[1],f)+d.timedelta(minutes=1)).strftime(f))\$\endgroup\$Matthew Willcockson– Matthew Willcockson2021εΉ΄10ζ07ζ₯ 10:33:59 +00:00Commented Oct 7, 2021 at 10:33 -
\$\begingroup\$ Also, with Python 3 a single character can be shaved off with f-strings:
lambda s:f"{(v:=int(s[:2])*60-~int(s[3:]))//60%24:02}:{v%60:02}"\$\endgroup\$Matthew Willcockson– Matthew Willcockson2021εΉ΄10ζ07ζ₯ 10:49:58 +00:00Commented Oct 7, 2021 at 10:49 -
\$\begingroup\$ @MatthewWillcockson Thanks, I somehow missed that! \$\endgroup\$dingledooper– dingledooper2021εΉ΄10ζ10ζ₯ 22:48:29 +00:00Commented Oct 10, 2021 at 22:48
-
1\$\begingroup\$ @MatthewWillcockson if you're so inclined, you can golf the "more normal" version down such that it's only 34 bytes longer tio.run/… \$\endgroup\$Alex Waygood– Alex Waygood2021εΉ΄10ζ11ζ₯ 09:54:19 +00:00Commented Oct 11, 2021 at 9:54
brainfuck, 216 bytes
,++++++++>,>>,>+>,++++>,+<<<[-<<-<-<+>>>>>>->-<<<]>>>[<<-]<<[>>----------<+[<-]<[->------<<<+<+[++++++[>-]>[<<[>>-]>>[<----<-->>->>]<]<<------>]>[<----------<+>>->]]<]<<<[->+>+>>+>>+>+<<<<<<<]>--------.>.>>.>>----.>.
The character : is the ASCII character after 9, so the program uses the one provided to it in the input to check if digits need to be carried, allowing it to avoid creating any large constants.
[
Read in the string and set up for the comparisons later. Increment minutes.
Subtract ':' from all characters and copy it elsewhere.
Layout: Cell # -1 0 1 2 3 4 5 6
Cell contents ':' A B _ _ 1 C D
The central 0 and 1 cells allow all of the conditionals to land near each other,
reducing the amount of travel needed in the worst case.
]
,++++++++>,>>,>+>,++++>,+
<<<[-<<-<-<+>>>>>>->-<<<]
# If minutes are 10: Carry
>>>[<<-]<<[
>>----------<+
# If tenminutes are 6: Carry
[<-]<[
->------<<<+<+
# If hours are not 10: Check for 24:00 rollover
[
++++++
[>-]>[
<<[>>-]>>[
<----<--
>>->>]
<]
<<------
# If hours are 10: Carry
>]>[
<----------<+
>>->]
]
<]
# Undo modifications from the start and print
<<<[->+>+>>+>>+>+<<<<<<<]
>--------.>.>>.>>----.>.
-
1\$\begingroup\$ Welcome to Code Golf! Nice answer! \$\endgroup\$2021εΉ΄10ζ13ζ₯ 03:57:43 +00:00Commented Oct 13, 2021 at 3:57
Java (JDK), (ει€) 83 (ει€γγγΎγ§) 49 bytes
i->java.time.LocalTime.parse(i).plusMinutes(1)+""
Huge cut-off thanks to Olivier GrΓ©goire
-
2\$\begingroup\$ 49 bytes by just using
LocalTimerather thanLocalDateTime\$\endgroup\$Olivier Grégoire– Olivier Grégoire2021εΉ΄10ζ07ζ₯ 07:37:34 +00:00Commented Oct 7, 2021 at 7:37
MATL, 12 bytes
YOl13L/+15XO
Beaten by Excel... :-D
Try it online! Or verify all test cases.
Explanation
YO % Implicit input. Convert to date number. The integer part represents date,
% the fractional part represents time of day
l % Push 1
13L % Push 1440 (predefined literal)
/ % Divide. Gives 1/1440, which is 1 minute expressed as fraction of a day
+ % Add
15XO % Convert to date string with format 15, which is 'HH:MM'
% Implicit display
Jelly, (ει€) 20 (ει€γγγΎγ§) 19 bytes
ΓDαΉ2αΈ£"Γ°<βΕpjβ¬":Γ°αΉiαΈ’
A monadic Link that accepts a list of characters and yields a list of characters.
How?
Surprisingly tricky to get anything below 22 in Jelly, no time-based functionality while parsing, evaluating and then adding leading zeros where needed is expensive, so I went with constructing all strings as a list and getting the next string cyclically.
ΓDαΉ2αΈ£"Γ°<βΕpjβ¬":Γ°αΉiαΈ’ - Link: characters, S
ΓD - digit characters -> "0123456789"
αΉ2 - Cartesian power 2 -> ["00",...,"99"]
"Γ°<β - list of code-page indices -> [24, 60]
αΈ£ - head to -> [["00",..."23"],["00",...,"59"]]
Εp - Cartesan product -> [["00","00"],...,["23","59"]]
jβ¬": - join each with colons -> ["00:00",...,"23:59"]
Γ° - start a new dyadic chain, f(Times, S)
i - first 1-indexed index of S in Times
αΉ - rotate Times left by that
αΈ’ - head
Powershell, 82 or 153 bytes
get-date ((get-date ($Time=read-host "Enter the time")).addminutes(1)) -uformat %R
Or, if you want to show the input as well as the output;
do {$Time=read-host "Enter the time"
write-host -nonewline $time `t
get-date ((get-date $Time).addminutes(1)) -uformat %R
} while ($Time)
-
\$\begingroup\$ Welcome to Code Golf, and nice first answer! Make sure to check out our tips for golfing in Powershell to see if there are any ways for you to shorten your answer. \$\endgroup\$Aaroneous Miller– Aaroneous Miller2021εΉ΄10ζ06ζ₯ 02:20:40 +00:00Commented Oct 6, 2021 at 2:20
Retina 0.8.2, 32 bytes
T`_d`d0`.9?(:59)?$
T`d`0`(24)?:6
Try it online! Link includes test cases. Explanation:
T`_d`d0`.9?(:59)?$
Increment all the digits in 09:59, 19:59, X:59, :X9 or just the last digit if nothing else matches. Incrementing 9 automatically rolls over to 0.
T`d`0`(24)?:6
Zero out 24:60 and the seconds of X:60 (X will already have been incremented above so it is correct).
C#, (ει€) 64 (ει€γγγΎγ§) (ει€) 62 (ει€γγγΎγ§) 55 bytes
-7 bytes thanks to asherber
(x)=>$"{System.DateTime.Parse(x).AddMinutes(1):HH:mm}";
Old version (62 Bytes)
(x)=>System.DateTime.Parse(x).AddMinutes(1).ToString("HH:mm");
-
3\$\begingroup\$ Save a few bytes with string interpolation.
(x)=>$"{System.DateTime.Parse(x).AddMinutes(1):HH:mm}";\$\endgroup\$asherber– asherber2021εΉ΄10ζ13ζ₯ 14:32:45 +00:00Commented Oct 13, 2021 at 14:32
Ruby -pl, 40 bytes
$_="#{Time.gm(1,1,~/:/,$`,$')+60}"[11,5]
~/:/ matches the colon in the input (yielding its index, 2), setting the pre- and post-match regexes $` and $' to the hour and minute, respectively.
Ruby -plaF:, 35 bytes
Suggested by @dingledooper
$_="#{Time.gm(1,1,1,*$F)+60}"[11,5]
The array $F is formed by automatically splitting the input at the colon.
Both versions perform the following operations:
- convert input to a
Timeobject, - add 60 seconds,
- convert to a string of the form
0001-01-dd hh:mm:00 UTC, where for the 40 byte versionddis either02or03(the latter only when the input is23:59); for the 35 byte version it is01, - extract the 11th to 15th characters.
It's somewhat noteworthy that Time#gm internally coerces string arguments to integers.
-
\$\begingroup\$ For more flag abuse, you might be able to do
$_="#{Time.gm(1,1,1,*$F)+60}"[11,5]+-plaF:\$\endgroup\$dingledooper– dingledooper2021εΉ΄10ζ04ζ₯ 23:04:15 +00:00Commented Oct 4, 2021 at 23:04 -
\$\begingroup\$ @dingledooper Thanks! Using
-F:felt a bit too cheaty but I've added it as an alternative. \$\endgroup\$Dingus– Dingus2021εΉ΄10ζ04ζ₯ 23:23:12 +00:00Commented Oct 4, 2021 at 23:23 -
1\$\begingroup\$ This combo is perhaps even more cheaty:
$_="#{Time.parse($_)+60}"[11,5]+-plrrss:P \$\endgroup\$dingledooper– dingledooper2021εΉ΄10ζ05ζ₯ 00:23:42 +00:00Commented Oct 5, 2021 at 0:23 -
\$\begingroup\$ @dingledooper Gotta love a monkey patch. We haven't even got to
-eyet ;) \$\endgroup\$Dingus– Dingus2021εΉ΄10ζ05ζ₯ 01:07:04 +00:00Commented Oct 5, 2021 at 1:07
C (gcc), (ει€) 71 (ει€γγγΎγ§) 69 bytes
Thanks to dingledooper for the -2.
The only sneaky things were to reuse the input parameter and cache the format string.
i,z;f(s){sscanf(s,z="%02d:%02d",&i,&s);printf(z,(i+s/60)%24,++s%60);}
-
\$\begingroup\$ One other sneaky thing you can do is to reuse the input format string, with
i,z;f(s){sscanf(s,z="%02d:%02d",&i,&s);printf(z,(i+s/60)%24,++s%60);};) \$\endgroup\$dingledooper– dingledooper2021εΉ΄10ζ05ζ₯ 03:42:57 +00:00Commented Oct 5, 2021 at 3:42
05AB1E, 18 bytes
23Γ59ΓΓ’Tβ°J':Γ½DIk>Γ¨
Try it online or verify all test cases.
Explanation:
23Γ # Push a list in the range [0,23]
59Γ # Push a list in the range [0,59]
Γ’ # Get the cartesian product of these two lists
Tβ°J # Format each integer to a string with potentially leading 0:
Tβ° # Take the divmod-10: [n//10,n%10]
J # And join these pairs of digits together
':Γ½ '# Join each inner pair together with ":" delimiter
D # Duplicate this list
Ik # Get the index of the input in this duplicated list
> # Increase it by 1
Γ¨ # And use it to index into the list
# (after which the result is output implicitly)
-
\$\begingroup\$ Wow. Much better than my clunky one \$\endgroup\$avarice– avarice2021εΉ΄10ζ05ζ₯ 09:20:44 +00:00Commented Oct 5, 2021 at 9:20
JavaScript (Chrome / Edge / Node), 50 bytes
Very hackish.
s=>(new Date(+new Date([1,s])+6e4)+s).slice(16,21)
Commented
s => // s = "HH:MM"
( new Date( // generate a date:
+new Date( // generate a timestamp corresponding to:
[1, s] // "1,HH:MM" which is interpreted as
// Mon Jan 01 2001 HH:MM:00
) // end of Date()
+ 6e4 // add 60000 milliseconds (1 minute)
) // end of Date()
+ s // coerce to a string
).slice(16, 21) // extract the updated "HH:MM"
R, (ει€) 46 (ει€γγγΎγ§) 43 bytes
-3 bytes thanks to Jonathan Carroll
Or R>=4.1, 36 bytes by replacing the word function with \.
function(t)format(strptime(t,h<-"%R")+60,h)
Without datetime functions:
R, (ει€) 89 (ει€γγγΎγ§) 85 bytes
function(t,`[`=substr,m=el(t[4,5]:0+1)%%60)sprintf("%02d:%02d",el(t[1,2]:0+!m)%%24,m)
-
1\$\begingroup\$ R4.1 function syntax really helps with golfing, but also
%Ris equivalent to%H:%M...\(t)format(strptime(t,h<-"%R")+60,h)for 36. \$\endgroup\$Jonathan Carroll– Jonathan Carroll2021εΉ΄10ζ14ζ₯ 23:27:16 +00:00Commented Oct 14, 2021 at 23:27
Python 3, (ει€) 100 (ει€γγγΎγ§) 95 bytes
from datetime import*
f='%H:%M'
t=lambda s:(datetime.strptime(s,f)+timedelta(0,60)).strftime(f)
-5 thanks to @pandubear
Python is terrible at this...
-
\$\begingroup\$ Ah, you are correct. Reverted \$\endgroup\$Seggan– Seggan2021εΉ΄10ζ04ζ₯ 22:57:50 +00:00Commented Oct 4, 2021 at 22:57
-
\$\begingroup\$ You can save 5 characters by changing
timedelta(minutes=1)totimedelta(0,60)! \$\endgroup\$Pandu– Pandu2022εΉ΄09ζ21ζ₯ 03:01:34 +00:00Commented Sep 21, 2022 at 3:01
Factor, 56 bytes
[ ":"without hhmm>duration 1 minutes time+ duration>hm ]
This doesn't run on TIO because the calendar.parser vocabulary postdates Factor build 1525 (the one TIO uses) by just a bit. Here's a screenshot of running it in build 1889, the official 0.98 stable release:
A screenshot of running the above code in the Factor Listener
Explanation
It's a quotation that takes a string from the data stack as input and leaves a string on the data stack as output. Assuming "23:59" is on top of the data stack when this quotation is called...
| Snippet | Comment | Data stack (the bottom is the top) |
|---|---|---|
":"without |
Remove the colon | |
hhmm>duration |
Parse a 4-digit string into a duration with hours and minutes | |
1 minutes |
Create a duration of one minute | |
time+ |
Add two durations and/or timestamps | |
duration>hm |
Convert a duration or timestamp to a HH:MM string | |
PHP, 40 bytes
fn($s)=>date('H:i',strtotime("$s+1min"))
PHP relative date formatting at its finest, trying to compress it to the max. Should take in account the DST following the locale
-
-
\$\begingroup\$ @Shaggy That's a significant improve compared to my answer, if you want to post as your own, be sure I'll upvote it! \$\endgroup\$Kaddath– Kaddath2021εΉ΄10ζ05ζ₯ 13:38:11 +00:00Commented Oct 5, 2021 at 13:38
MathGolf, 24 bytes
βrβ γγγgΓ¦βM<ΓmΓ²β+βmβ':u_l=)Β§
Explanation:
βr # Push a list in the range [0,60)
β γγγ # Take the cartesian product with itself
g # Filter this list of pairs by,
Γ¦ # using the following four characters as inner code-block:
β Γ # Where the first value of the pair
M< # Is smaller than 24
m # Then map each remaining pair to,
Γ² # using the following eight characters as inner code-block:
β+ # Add 100 to both integers
β # Convert both to a string
mβ # Remove the first character (the "1") from both strings
':u '# Join this pair with ":" delimiter
_ # After the map, duplicate the list of all possible times
l= # Get the index of the string-input in this duplicated list
) # Increase it by 1
Β§ # And use it to (0-based modulair) index into the list
# (after which the entire stack is output implicitly as result)
SQL Server, 36 bytes
select left(dateadd(n,1,a),5) from t
Try it online (using all of the input values given in the question).
-
2\$\begingroup\$ Welcome to Code Golf! \$\endgroup\$2021εΉ΄10ζ14ζ₯ 01:08:24 +00:00Commented Oct 14, 2021 at 1:08
-
1\$\begingroup\$ Your post has an extra space before the 5 that's not there in the actual code. \$\endgroup\$Neil– Neil2021εΉ΄10ζ14ζ₯ 16:29:05 +00:00Commented Oct 14, 2021 at 16:29
-
\$\begingroup\$ Thanks, @Neil, I fixed it. Doesn't lower my score, though, unfortunately - the score was based on the correct version that didn't have the extra space. \$\endgroup\$tysonwright– tysonwright2021εΉ΄10ζ14ζ₯ 17:10:12 +00:00Commented Oct 14, 2021 at 17:10
PowerShell, 33 bytes
%{'{0:HH:mm}'-f((Date $_)+'0:1')}
Input comes from the pipeline.
Try it in a PS console (Windows or Core):
'00:00', '00:02', '05:55', '09:59', '12:49', '20:05', '23:59'|%{'{0:HH:mm}'-f((Date $_)+'0:1')}
Explanation
% is an Alias for the Cmdlet "ForEach-Object", which accepts input from the pipeline and processes each incoming object inside the ScriptBlock {...}
'{0:HH:mm}' is the output string; {0:HH:mm} is a placeholder for the first argument of the following -f format operator. It contains formatting information to print a DateTime object in 24 hour format.
-f is the format operator, which will replace the placeholder with the actual time. Using -f is shorter than calling the .ToString('HH:mm') method.
((Date $_)+'0:1') does the heavy lifting: It first turns the current string coming in from the pipeline ($_) into a DateTime object by passing it to the Cmdlet Get-Date. The 'Get-' is implicit in PS, so leaving it out saves 4 bytes (Disclaimer: never use that in a regular script; it slows things down, because PS will search the path for a matching command as well - each time it's called!).
Now that there's a DateTime object on the left side, and PS sees an Add operation, it interpretes the '0:1' as timespan of 1 minute (try [TimeSpan]'0:1' in a PS console); this is shorter than using the DateTime's object AddMinutes() method.
The result of the addition is then inserted into the string, output is implicit.
QBasic, (ει€) 132 (ει€γγγΎγ§) 129 bytes
INPUT t$
i=6
1i=i-1+f
x=ASC(MID$(t,γγ«i))-47
f=i=4
x=x<10+f*4AND x
MID$(t,γγ«i,1)=CHR$(x+48)
IF x=0GOTO 1
IF"24"<t$THEN t$="00:00
?t$
Explanation
' Read the input time into t$
INPUT t$
' i is the index of the current digit, starting one digit to the right of the string
i = 6
' Label 1 is the start of the loop
1
' Subtract 1 from i, and subtract an additional 1 if f is set (see below)
i = i - 1 + f
' x is the current digit plus 1
x = ASC(MID$(t,γγ« i)) - 47
' f is true (-1) only when i = 4
f = (i = 4)
' If x = 10, or if f is true and x = 6, set x to 0; otherwise, leave it unchanged
x = x < (10 + f * 4) AND x
' Write that digit back into the string t$ at the current position
MID$(t,γγ« i, 1) = CHR$(x + 48)
' Loop if this digit wrapped around to 0
IF x = 0 THEN GOTO 1
' Special case: when t$ is 24:00, wrap around to 00:00
IF "24" < t$ THEN t$ = "00:00"
' Print the final result
PRINT t$
Scala, 52 bytes
java.time.LocalTime.parse(_).plusMinutes(1).toString
Straightforward approach: parse string as time information via built-in functionality, add one minute to it, output as string
Batch, 83 bytes
@set/ps=
@set/am=6%s::=*60+1%-99,h=m/60%%24+100,m=m%%60+100
@echo %h:~-2%:%m:~-2%
Takes input on STDIN. Explanation:
@set/ps=
Read in the time.
@set/am=6%s::=*60+1%-99,h=m/60%%24+100,m=m%%60+100
Batch parses leading 0s as octal, so to allow hours and minutes to be 08 or 09, 6 is prefixed to the hours and 1 to the minutes. Additionally, the : is changed to *60+ and the resulting string evaluated. The 6 prefix does not change the overall result because 600 hours is exactly 25 days, while the 1 adds 100 minutes so 99 minutes are subtracted to obtain the desired total number of minutes. The total minutes are then divided back into hours and minutes, but with 100 added so that the last two digits can be extracted.
@echo %h:~-2%:%m:~-2%
Print the last two digits to get the real hours and minutes again.
Julia 1.0, 66 bytes
using Dates;f="HH:MM";g(s)=Dates.format(DateTime(s,f)+Minute(1),f)
Using libraries because why not and it's still shorter than Python.
Julia 1.0, (ει€) 43 (ει€γγγΎγ§) 42 bytes
using Dates
~t="$(Time(t)+Minute(1))"[1:5]