Here you can find the source of formatDateAndTime(Date date)
Parameter | Description |
---|---|
date | the date |
public static String formatDateAndTime(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w ww. ja v a 2 s. com*/ * Format date and time. * * @param date * the date * @return the string */ public static String formatDateAndTime(Date date) { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sd.format(date); } }