Here you can find the source of toInfo(Calendar calendar)
Parameter | Description |
---|---|
calendar | a parameter |
public static String toInfo(Calendar calendar)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { /**/*from w w w. j a v a2s .co m*/ * @param date */ public static String toInfo(Date date) { return toInfo(date, "yyyy-MM-dd HH:mm:ss"); } /** * @return */ public static String toInfo() { return toInfo(getCalendar().getTime(), "yyyy-MM-dd"); } /** * @param date * @param dateFromat */ public static String toInfo(Date date, String dateFromat) { SimpleDateFormat format = new SimpleDateFormat(dateFromat); return format.format(date); } /** * @param calendar */ public static String toInfo(Calendar calendar) { return toInfo(calendar.getTime()); } public static long getTime() { return getTime(getCalendar()); } public static long getTime(Calendar c) { return c.getTimeInMillis(); } public static Calendar getCalendar() { return Calendar.getInstance(); } public static String format() { return toInfo(getCalendar()); } }