Java Date to String date2Str(final Date date, final String dateFormat)

Here you can find the source of date2Str(final Date date, final String dateFormat)

Description

date Str

License

Open Source License

Parameter

Parameter Description
date a parameter
dateFormat a parameter

Declaration

public static String date2Str(final Date date, final String dateFormat) 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**/*  ww  w . j ava  2 s  . com*/
     *
     * @param date
     * @param dateFormat
     * @return
     */
    public static String date2Str(final Date date, final String dateFormat) {
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        try {
            return sdf.format(date);
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. date2Str(Date date, String format)
  2. date2Str(Date date, String format)
  3. date2Str(Date date, String partten)
  4. date2Str(Date date, String pattern)
  5. date2Str(Date value)
  6. date2Str(SimpleDateFormat date_sdf)
  7. date2string(Date _aDate)
  8. date2string(Date date)
  9. date2String(Date date)