Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static String getTimeDisplay(Calendar cal) { SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm aa", Locale.getDefault()); return dateFormat.format(cal.getTime()); } }