Here you can find the source of dateToString(Date date)
Parameter | Description |
---|---|
date | the date to convert. |
public static String dateToString(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** Represents the data format. */ private static final String DATE_FORMAT = "MM.dd.yyyy h:mm a"; /**//from w w w . j a va 2s . co m * Convert a date object to string. * * @param date the date to convert. * * @return the string representation. */ public static String dateToString(Date date) { SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT); return formatter.format(date); } }