Here you can find the source of getTime(Calendar calendar)
Parameter | Description |
---|---|
calendar | a parameter |
public static String getTime(Calendar calendar)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String getTime() { return getTime(Calendar.getInstance().getTime()); }/* ww w. j a v a 2s. co m*/ /** * @param calendar * @return */ public static String getTime(Calendar calendar) { return getTime(calendar.getTime()); } public static String getTime(long mills) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(mills); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy/MM/dd HH:mm"); return simpleDateFormat.format(calendar.getTime()); } public static String getTime(Date date) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy/MM/dd HH:mm"); return simpleDateFormat.format(date); } }