get Now Time in HH format - Android java.util

Android examples for java.util:Hour

Description

get Now Time in HH format

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getNowTime() {
        SimpleDateFormat formatter = new SimpleDateFormat("HH");
        Date curDate = new Date(System.currentTimeMillis());
        return formatter.format(curDate);
    }/*ww w . j  av a 2  s .c  o m*/
}

Related Tutorials