Code example for Date

Methods: getMinutes

0
    @SuppressWarnings("nls") 
    public static String getTimeString(Context context, Date date, boolean excludeZeroMinutes) {
        String value;
        if (is24HourFormat(context)) {
            value = "H:mm";
        } else if (date.getMinutes() == 0 && excludeZeroMinutes){
            value = "h a";
        } 
        else { 
            value = "h:mm a";
        } 
        return new SimpleDateFormat(value).format(date);
    } 
 
    public static String getTimeString(Context context, Date date) {
        return getTimeString(context, date, true);
    } 
 
    /* Returns true if search string is in sortedValues */ 
 
    private static boolean arrayBinaryContains(String search, String... sortedValues) {