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: LGPL import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yy/MM/dd HH:mm"); public static String getTime() { return getTime(Calendar.getInstance().getTime()); }//w w w .ja v a 2s . com /** * @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); return simpleDateFormat.format(calendar.getTime()); } public static String getTime(Date date) { return simpleDateFormat.format(date); } }