Here you can find the source of getCalendarStringTime(Calendar c)
Parameter | Description |
---|---|
c | Calendar |
public static String getCalendarStringTime(Calendar c)
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class Main { /** Get time from a Calendar * @param c Calendar/*from www .jav a2 s. co m*/ * @return Time String */ public static String getCalendarStringTime(Calendar c) { DateFormat dfm = new SimpleDateFormat("HH:mm:ss"); return dfm.format(c.getTime()); } /** Get time from a Calendar with specific TimeZone * @param c Calendar * @param z TimeZone * @return Time String */ public static String getCalendarStringTime(Calendar c, TimeZone z) { DateFormat dfm = new SimpleDateFormat("HH:mm:ss"); dfm.setTimeZone(z); return dfm.format(c.getTime()); } /** Converts play time into a String * @param t Play time * @return String for play time */ public static String getTime(int t) { if (t < 0) return "--:--.--"; return String.format("%02d:%02d.%02d", t / 3600, t / 60 % 60, t % 60 * 5 / 3); } }