Here you can find the source of convertDateToString(String mask, Date date)
Parameter | Description |
---|---|
mask | the date pattern the string is in |
date | a date object |
public static final String convertDateToString(String mask, Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/* w w w . ja v a 2s. c om*/ * This method generates a string representation of a date's date/time * in the format you specify on input. * * @param mask the date pattern the string is in * @param date a date object * @return a formatted string representation of the date */ public static final String convertDateToString(String mask, Date date) { SimpleDateFormat df = null; String returnValue = ""; if (date == null) { } else { df = new SimpleDateFormat(mask); returnValue = df.format(date); } return returnValue; } }