Android Time Format formatDisplay(int second)

Here you can find the source of formatDisplay(int second)

Description

Format second to display format like 3:20:30

Parameter

Parameter Description
second a parameter

Declaration

public static String formatDisplay(int second) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static final String TIME_DISPLAY_FORMAT = "HH:mm:ss";

    /**/* w ww.j a  v a  2  s.  c o m*/
     * Format second to display format like 3:20:30
     * @param second
     * @return
     */
    public static String formatDisplay(int second) {
        return format(TIME_DISPLAY_FORMAT, second * 1000);
    }

    private static String format(String pattern, long timeInMillis) {
        final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(new Date(timeInMillis));
    }
}

Related

  1. dateToString(Time t)
  2. toISO8601Date(Time date)
  3. formatDateAndTime(int timestamp, String pattern)
  4. formatDate(String mounthStr)
  5. dateTimeFormat(String dateTime)
  6. dateTimeFormat(String dateTime)