Java Date to String dateToString(Date pDate, String pFormat)

Here you can find the source of dateToString(Date pDate, String pFormat)

Description

Format a date in string using pFormat.

License

Apache License

Parameter

Parameter Description
pDate the date to parse.
pFormat the format to use following SimpleDateFormat patterns.

Return

the formatted date.

Declaration

public static String dateToString(Date pDate, String pFormat) 

Method Source Code

//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);
    }
}

Related

  1. datetostring(Date dateInst)
  2. DateToString(Date Expression)
  3. dateToString(Date fecha)
  4. DateToString(Date fecha, String formato)
  5. dateToString(Date pd_fecha)
  6. dateToString(Date pdttValue, String pstrDateFormat)
  7. DateToString(Date thisdate, Locale locale)
  8. dateToString(final Date date)
  9. dateToString(final Date value, final boolean utc)