Here you can find the source of date2Str(Date aDate)
public static final String date2Str(Date aDate)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String date2Str(Date aDate) { SimpleDateFormat df = null; String returnValue = ""; if (aDate != null) { df = new SimpleDateFormat("yyyy-MM-dd"); returnValue = df.format(aDate); }//from w w w . j av a2s . c om return (returnValue); } public static final String date2Str(String pattern, Date aDate) { SimpleDateFormat df = null; String returnValue = ""; if (aDate != null) { df = new SimpleDateFormat(pattern); returnValue = df.format(aDate); } return (returnValue); } }