Here you can find the source of dateToString_yyyyMMddHHmmssSSS(Date date)
public static String dateToString_yyyyMMddHHmmssSSS(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static final String DATETIME_PATTERN_LONG2 = "yyyyMMddHHmmssSSS"; public static String dateToString_yyyyMMddHHmmssSSS(Date date) { if (date == null) { return null; }// ww w. j av a 2s . com return formatDateTime(date, DATETIME_PATTERN_LONG2); } public static String formatDateTime(Date d) { return formatDateTime(d, DATETIME_PATTERN); } public static String formatDateTime(Date d, String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(d); } }