Here you can find the source of formatarData(Date data)
public static String formatarData(Date data)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String FORMATO_DATA_DD_MM_AAAA_BARRA = "dd/MM/yyyy"; public static String formatarData(Date data, String pattern) { String stData = ""; if ((data != null) && (pattern != null)) { DateFormat format = new SimpleDateFormat(pattern); stData = format.format(data); }//from w w w .j a va 2s .c o m return stData; } public static String formatarData(Date data) { return formatar(data, FORMATO_DATA_DD_MM_AAAA_BARRA); } public static String formatar(Date data, String pattern) { String stData = ""; if ((data != null) && (pattern != null)) { DateFormat format = new SimpleDateFormat(pattern); stData = format.format(data); } return stData; } }