Format time as hh:mm:ss format - Android java.util

Android examples for java.util:Time

Description

Format time as hh:mm:ss format

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static String time() {
        SimpleDateFormat format = new SimpleDateFormat("hh:mm:ss");
        Calendar c = Calendar.getInstance();
        String date = format.format(c.getTime());
        return date;
    }//from   www.  j  a v a 2s . c  o m
}

Related Tutorials