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

Android examples for java.util:Hour

Description

Format Calendar time as hh:mm format

Demo Code


//package com.java2s;

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

public class Main {
    public static String time2() {
        SimpleDateFormat format = new SimpleDateFormat("hh:mm");
        Calendar c = Calendar.getInstance();
        String date = format.format(c.getTime());
        return date;
    }//w  w w  .j  ava2  s  .c  o m
}

Related Tutorials