Java tutorial
import java.util.Calendar; import java.util.Formatter; public class Main { public static void main(String[] argv) throws Exception { Formatter fmt = new Formatter(); Calendar cal = Calendar.getInstance(); fmt.format("Hour and Minute: %tl:%1$tM %1$Tp\n", cal); // Display the formatted times and dates. System.out.println(fmt); } }