Here you can find the source of formatDateTime(java.util.Date d)
public static final String formatDateTime(java.util.Date d)
//package com.java2s; import java.text.SimpleDateFormat; public class Main { public static final String formatDateTime(java.util.Date d) { // DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); SimpleDateFormat df = new SimpleDateFormat("yy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); return (df.format(d) + " " + sdf.format(d)); }/* ww w .jav a 2 s . c o m*/ public static final String formatDateTime(java.util.Date d, String format) { SimpleDateFormat df = new SimpleDateFormat(format); return df.format(d); } }