String datestamp; TimeZone gmt = TimeZone.getDefault(); GregorianCalendar now = new GregorianCalendar(gmt); now.setTime(dateToFormat); datestamp = "" + now.get(Calendar.YEAR); datestamp += prependSingle(now.get(Calendar.MONTH) + 1); datestamp += prependSingle(now.get(Calendar.DAY_OF_MONTH)); datestamp += prependSingle(now.get(Calendar.HOUR_OF_DAY)); datestamp += prependSingle(now.get(Calendar.MINUTE)); if(includeSeconds) { datestamp += prependSingle(now.get(Calendar.SECOND)); } return datestamp;
String datestamp; TimeZone gmt = TimeZone.getDefault(); GregorianCalendar now = new GregorianCalendar(gmt); now.setTime(dateToFormat); datestamp = "" + now.get(Calendar.YEAR); datestamp += prependSingle(now.get(Calendar.MONTH) + 1); datestamp += prependSingle(now.get(Calendar.DAY_OF_MONTH)); datestamp += prependSingle(now.get(Calendar.HOUR_OF_DAY)); datestamp += prependSingle(now.get(Calendar.MINUTE)); if (includeSeconds) { datestamp += prependSingle(now.get(Calendar.SECOND));
    public static String formatTimeStamp(Date dateToFormat, 					 boolean includeSeconds) {	String datestamp;	TimeZone gmt = TimeZone.getDefault();	GregorianCalendar now = new GregorianCalendar(gmt);	now.setTime(dateToFormat);	datestamp = "" + now.get(Calendar.YEAR);	datestamp += prependSingle(now.get(Calendar.MONTH) + 1);	datestamp += prependSingle(now.get(Calendar.DAY_OF_MONTH));	datestamp += prependSingle(now.get(Calendar.HOUR_OF_DAY));	datestamp += prependSingle(now.get(Calendar.MINUTE));	if(includeSeconds) {	    datestamp += prependSingle(now.get(Calendar.SECOND));	}	return datestamp;    }   