Here you can find the source of calFormatTime(final Calendar cal)
Parameter | Description |
---|---|
cal | the Calendar to format |
public static String calFormatTime(final Calendar cal)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static final String TIME_FORMAT = "hh:mm a"; /**//from w w w .java 2 s . c o m * Formats a {@linkplain Calendar} to the application wide format for time * * @param cal * the {@linkplain Calendar} to format * @return the formated {@linkplain Calendar} */ public static String calFormatTime(final Calendar cal) { SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); return sdf.format(cal.getTime()); } }