Here you can find the source of timeToString(Calendar date)
public static String timeToString(Calendar date)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static final DateFormat FORMAT_DATE = new SimpleDateFormat("dd/MM/yyyy"); public static final DateFormat FORMAT_TIME = new SimpleDateFormat("HH:mm"); public static String timeToString(Calendar date) { return dateToString(date, FORMAT_TIME); }/*from www . j a va2s . co m*/ public static String dateToString(Calendar date) { return dateToString(date, FORMAT_DATE); } public static String dateToString(Calendar date, DateFormat format) { if (date == null) return null; return format.format(date.getTime()); } }