Here you can find the source of getDateFormat(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static Date getDateFormat(Date date)
//package com.java2s; //License from project: Apache License import java.util.Date; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static final String simple = "yyyy-MM-dd HH:mm:ss"; /**//from www . j a va 2 s .c om * Date Format yyyy-MM-dd HH:mm:ss * * @param date * @return yyyy-MM-dd HH:mm:ss */ public static Date getDateFormat(Date date) { SimpleDateFormat df = new SimpleDateFormat(simple); try { return df.parse(df.format(date)); } catch (ParseException e) { e.printStackTrace(); } return date; } }