Here you can find the source of formatDateTime(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static final String formatDateTime(Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat SDF_DETAIL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); /**//w w w. ja va 2 s.c o m * Format the Date object to string with format "yyyy-MM-dd HH:mm:ss" * @param date * @return */ public static final String formatDateTime(Date date) { if (date != null) { synchronized (SDF_DETAIL) { return SDF_DETAIL.format(date); } } else { return null; } } }