Here you can find the source of date2String(Date date, String format)
public static String date2String(Date date, String format)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String date2String(Date date) { if (date == null) return ""; SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); return format.format(date); }/*from w w w . java2 s. com*/ public static String date2String(Date date, String format) { if (date == null) return ""; SimpleDateFormat sdformat = new SimpleDateFormat(format); return sdformat.format(date); } }