Android Hour Format getReminderReadableTime(int hour, int minute)

Here you can find the source of getReminderReadableTime(int hour, int minute)

Description

get Reminder Readable Time

Declaration

public static String getReminderReadableTime(int hour, int minute) 

Method Source Code

//package com.java2s;

public class Main {
    public static String getReminderReadableTime(int hour, int minute) {
        StringBuilder sb = new StringBuilder();
        String period = " AM";
        if (hour == 0) {
            hour = 12;//from   w  ww .ja v a 2  s  .  com
            period = " AM";
        } else if (hour == 12) {
            period = " PM";
        } else if (13 <= hour && hour <= 23) {
            period = " PM";
            hour = hour % 12;
        }

        if (hour < 10) {
            sb.append("0");
        }

        sb.append(hour);
        sb.append(":");

        if (minute < 10) {
            sb.append("0");
        }

        sb.append(minute);
        sb.append(period);
        return sb.toString();
    }
}

Related

  1. formatHour(String string)
  2. formatHour(int val)
  3. getCurrentHour()
  4. getDateByAddHour(String datetime, int minute)
  5. getDateByAddFltHour(float flt)
  6. homiToString(int hour, int minute)