Here you can find the source of formatDate(Date fecha)
public static String formatDate(Date fecha)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatDate(Date fecha) { if (fecha == null) fecha = new Date(); SimpleDateFormat formatoDelTexto = new SimpleDateFormat("yyyy/MM/dd"); return formatoDelTexto.format(fecha);//que formatee la fecha en el formato anterior }/* w w w. j a v a2s . c o m*/ }