Here you can find the source of formatAsDateAndTime(Date date)
public static String formatAsDateAndTime(Date date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat sdfDateAndTime = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); public static String formatAsDateAndTime(Date date) { if (date != null) { return sdfDateAndTime.format(date); }//w ww . j a v a 2 s .co m return null; } }