Here you can find the source of dateFormat(Date date)
public static Date dateFormat(Date date)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date dateFormat(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date value = new Date(); try {// ww w . ja v a 2s . c o m value = sdf.parse(sdf.format(date)); } catch (ParseException e) { e.printStackTrace(); } return value; } }