Here you can find the source of getFullTimeToString(Calendar argCal)
public static String getFullTimeToString(Calendar argCal)
//package com.java2s; /*//from w w w. ja v a2 s . c o m Copyright 2005-2015, Olivier PETRUCCI. This file is part of Areca. Areca is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Areca is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Areca; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static final String TIME_SEPARATOR = "h"; public static final String FULL_TIME_SEPARATOR = "-"; /** * Return [HH]h[mm]-[ss]-[ms] */ public static String getFullTimeToString(Calendar argCal) { Calendar cal = argCal; if (cal == null) { cal = new GregorianCalendar(); } String date = getTimeToString(cal) + FULL_TIME_SEPARATOR; if (cal.get(Calendar.SECOND) < 10) { date += "0"; } date += cal.get(Calendar.SECOND) + FULL_TIME_SEPARATOR; if (cal.get(Calendar.MILLISECOND) < 10) { date += "0"; } if (cal.get(Calendar.MILLISECOND) < 100) { date += "0"; } date += cal.get(Calendar.MILLISECOND); return date; } /** * Return [HH]h[mm] */ public static String getTimeToString(Calendar argCal) { Calendar cal = argCal; if (cal == null) { cal = new GregorianCalendar(); } String date = ""; if (cal.get(Calendar.HOUR_OF_DAY) < 10) { date += "0"; } date += cal.get(Calendar.HOUR_OF_DAY) + TIME_SEPARATOR; if (cal.get(Calendar.MINUTE) < 10) { date += "0"; } date += cal.get(Calendar.MINUTE); return date; } public static String getTimeToString() { return getTimeToString(null); } }