get Current Time in HH:mm format - Android java.util

Android examples for java.util:Date Time

Description

get Current Time in HH:mm format

Demo Code

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

public class Main{

    public static String getCurrentFormatTime() {
        SimpleDateFormat format = new SimpleDateFormat("HH:mm");
        String nowTime = format.format(new Date());
        return nowTime;
    }/*from   ww  w  . j  a v a2s  .  c  o  m*/

}

Related Tutorials