Here you can find the source of formatDateTime(Date date)
public static String formatDateTime(Date date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static SimpleDateFormat SDF_DATE = new SimpleDateFormat("dd-MM-yyyy"); private static SimpleDateFormat SDF_TIME = new SimpleDateFormat("HH:mm:ss"); public static String formatDateTime(Date date) { return formatTime(date) + ' ' + formatDate(date); }//from w ww . j a v a 2 s . c o m public static String formatTime(Date date) { return SDF_TIME.format(date); } public static String formatDate(Date date) { return SDF_DATE.format(date); } }