Java tutorial
//package com.java2s; public class Main { public static String normalizeTime(String militaryTime) { String[] timeBrokenUp = militaryTime.split(":"); // 1 = HRS // 2 = MINS // 3 = SECONDS // we only want hrs and mins and have hrs in normal time String HR = timeBrokenUp[0]; String MIN = timeBrokenUp[1]; String AMorPM = "AM"; int valueOfHR = Integer.valueOf(HR); // so we are deaing with military time if (Integer.valueOf(HR) > 12) { valueOfHR = valueOfHR - 12; AMorPM = "PM"; } HR = String.valueOf(valueOfHR); militaryTime = HR + ":" + MIN + " " + AMorPM; return militaryTime; } }