Android examples for java.util:Date Time
convert Time To Small Format
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String convertTimeToSmallFormat(int hour, int minute) { String time = ""; try {/*w w w.j a v a 2 s. co m*/ String _24HourTime = String.valueOf(hour) + ":" + String.valueOf(minute); SimpleDateFormat _24HourSDF = new SimpleDateFormat("HH:mm"); SimpleDateFormat _12HourSDF = new SimpleDateFormat("hh:mm a"); Date _24HourDt = _24HourSDF.parse(_24HourTime); time = _12HourSDF.format(_24HourDt); } catch (ParseException e) { e.printStackTrace(); } return time; } }