get Time Display from Calendar - Android java.util

Android examples for java.util:Calendar Format

Description

get Time Display from Calendar

Demo Code


//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import java.util.Locale;

public class Main {
    public static String getTimeDisplay(Calendar cal) {

        SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm aa",
                Locale.getDefault());
        return dateFormat.format(cal.getTime());
    }//from   www  .  j a v  a  2  s . com
}

Related Tutorials