Here you can find the source of convertDateToString(Date aDate)
Parameter | Description |
---|---|
aDate | A date to convert |
public static final String convertDateToString(Date aDate)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static String defaultDatePattern = "yyyy-MM-dd"; /**/*ww w .j ava 2s. c o m*/ * This method generates a string representation of a date based on the * System Property 'dateFormat' in the format you specify on input * * @param aDate * A date to convert * @return a string representation of the date */ public static final String convertDateToString(Date aDate) { return getDateTime(getDatePattern(), aDate); } /** * This method generates a string representation of a date's date/time in * the format you specify on input * * @param aMask * the date pattern the string is in * @param aDate * a date object * @return a formatted string representation of the date * * @see java.text.SimpleDateFormat */ public static final String getDateTime(String aMask, Date aDate) { SimpleDateFormat df = null; String returnValue = ""; df = new SimpleDateFormat(aMask); returnValue = df.format(aDate); return (returnValue); } /** * Return default datePattern (yyyy-MM-dd) * * @return a string representing the date pattern on the UI */ public static synchronized String getDatePattern() { return defaultDatePattern; } }