In my app, I have a requirement to format 12 hours time to 24 hours time. What is the method I have to use?
12 hours
24 hours
For example, time like 10
10
static String timeConversion(String s) { String s1[]=s.split(":"); char c[]=s1[2].toCharArray(); if(s1[2].contains("PM")) { int n=Integer.parseInt(s1[0]); n=n+12; return n+":"+s1[1]+":"+c[0]+c[1]; } else`` return s1[0]+":"+s1[1]+":"+c[0]+c[1]; }