Here you can find the source of dateToString(Date pDate, String pFormat)
Parameter | Description |
---|---|
pDate | the date to parse. |
pFormat | the format to use following SimpleDateFormat patterns. |
public static String dateToString(Date pDate, String pFormat)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from w w w . j a v a 2 s .c om * Format a date in string using pFormat. * * @param pDate * the date to parse. * @param pFormat * the format to use following SimpleDateFormat patterns. * * @return the formatted date. */ public static String dateToString(Date pDate, String pFormat) { SimpleDateFormat dateFormat = new SimpleDateFormat(pFormat); return dateFormat.format(pDate); } }