+ 1
How to convert a given 12 hour time format in hh:mm:ss AM/PM to 24 hour format if the function only takes a string as an input
lets say time given is 7:49:50 PM the output should be 19:49:50 the problem I am facing is that how to read from string and compute the string values from string to numeric then return a 24 hour format that is also a string.
7 Respostas
+ 3
Use an If statement to see if the string includes pm or am and add 12 to the first number before the “:” if it’s pm
+ 1
in Java there is a class to deal with time and date......
check this link out.....
https://beginnersbook.com/2014/
+ 1
Thanks everyone, finally got a working code!
https://code.sololearn.com/cO9CVRNBHiX9/?ref=app
0
@Ariela .. yup that's a good one 👍
0
Try running on a pc, i am getting the results though!