try { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); return formatter.format(date); } catch (Throwable e) {    } return Long.toString(System.currentTimeMillis());
Calendar c = Calendar.getInstance(); c.setTime(date); StringBuffer sb = new StringBuffer(); appendPaddedInt(c.get(Calendar.YEAR), 4, sb).append('-'); appendPaddedInt(c.get(Calendar.MONTH) + 1, 2, sb).append('-'); appendPaddedInt(c.get(Calendar.DAY_OF_MONTH), 2, sb).append(' '); appendPaddedInt(c.get(Calendar.HOUR_OF_DAY), 2, sb).append(':'); appendPaddedInt(c.get(Calendar.MINUTE), 2, sb).append(':'); appendPaddedInt(c.get(Calendar.SECOND), 2, sb).append('.'); appendPaddedInt(c.get(Calendar.MILLISECOND), 3, sb); return sb.toString();
	protected String getDate(Date date) {		try {			DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); //$NON-NLS-1$			return formatter.format(date);		} catch (Throwable e) {			// If there were problems writing out the date, ignore and			// continue since that shouldn't stop us from logging the rest			// of the information		}		return Long.toString(System.currentTimeMillis());	}