get hour:minute - Android java.util

Android examples for java.util:Minute

Description

get hour:minute

Demo Code


//package com.java2s;

import java.util.Date;

public class Main {
    /**//from  ww  w  . j  ava2  s .  co  m
     * get hour:minute
     *
     * @return ex. 00:00, 12:32
     */
    public static String getTimehhmm() {
        return (String) android.text.format.DateFormat.format("hh:mm",
                new Date());
    }

    /**
     * get hour:minute
     *
     * @return ex. 00:00, 12:32
     */
    public static String getTimehhmm(Date d) {
        return (String) android.text.format.DateFormat.format("hh:mm", d);
    }
}

Related Tutorials