Created
October 14, 2019 20:34
-
-
Save imedadel/1d27270824d31ba2c95e59f08f3f9289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static String timeConversion(String s) { | |
| String t = s.substring(0, 2); | |
| String p = s.substring(s.length() - 2, s.length()); | |
| if(p.equals("AM")) { | |
| if(t.equals("12")) t = "00"; | |
| } else { | |
| if(!t.equals("12")) t = Integer.toString(Integer.parseInt(t) + 12); | |
| } | |
| return t + s.substring(2, s.length()-2); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment