0

How to make time converter

How to covert AM into PM in JAVA

26th Feb 2020, 12:37 PM
Maksym Mazumder
Maksym Mazumder - avatar
4 Respuestas
0
[edit: If you are, about code coach problem,] What you have tried so far..? Pls first Try and share your code... Hint: Not am to pm, it's about 0 to 24 hour farmat instead of 12hr so 1PM means 13:00 hours..
26th Feb 2020, 12:55 PM
Jayakrishna 🇮🇳
0
or with time string check position of colon with st.indexOf() parse hours Integer.parseInt( st.substring() ) hours+12 +st.substring() //rest of string
27th Feb 2020, 12:22 AM
zemiak
0
or with LocalTIme or Calendar type of time use String.format() with "%tT" as parameter or printf() for direct output
27th Feb 2020, 8:11 AM
zemiak