Java Time Format formatInformalTime(final String minuteRoundedName, final String minuteRoundingToken, final String informalHourName)

Here you can find the source of formatInformalTime(final String minuteRoundedName, final String minuteRoundingToken, final String informalHourName)

Description

Generate nicely formatted conversational / informal time string, intelligently dealing with whitespace.

License

Open Source License

Parameter

Parameter Description
minuteRoundedName e.g., '5 past'
minuteRoundingToken - e.g. - 'nearly'
informalHourName - e.g.: 'midnight', 'noon', one am

Return

informalTime - nicely formatted informal time string

Declaration

private static String formatInformalTime(final String minuteRoundedName, final String minuteRoundingToken,
        final String informalHourName) 

Method Source Code

//package com.java2s;

public class Main {
    /**//w ww  .j  a v a2 s.c  om
     * Generate nicely formatted conversational / informal time string,
     * intelligently dealing with whitespace.
     * 
     * @param minuteRoundedName
     *            e.g., '5 past'
     * @param minuteRoundingToken
     *            - e.g. - 'nearly'
     * @param informalHourName
     *            - e.g.: 'midnight', 'noon', one am
     * @return informalTime - nicely formatted informal time string
     */
    private static String formatInformalTime(final String minuteRoundedName, final String minuteRoundingToken,
            final String informalHourName) {
        String informalTime;
        if ("".equals(minuteRoundedName)) {
            informalTime = minuteRoundingToken + informalHourName;
        } else {
            informalTime = minuteRoundingToken + minuteRoundedName + " " + informalHourName;

        }
        return informalTime;
    }
}

Related

  1. formatElapsedTime(long elapsedTime)
  2. formatElapsedTime(long time)
  3. formatEndRowKeyString(String id, String timestampEnd)
  4. formatExecutionTime(long executionTime)
  5. formatExecutionTime(long ms)
  6. formatMeasures(final int quartersPerMeasure, final double time, final int startOffset)
  7. formatMicroSpan(long time)
  8. formatMili(long timeDelta)
  9. formatMs(long elapsedTime)