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

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

Description

date Str

License

Open Source License

Declaration

public static String date2Str(Date date, String dateFormat) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String YYYYMMDDHHMMSS = "yyyy-MM-dd HH:mm:ss";

    public static String date2Str(Date date) {
        return date2Str(date, YYYYMMDDHHMMSS);
    }//from  ww w  . j a va 2 s . c om

    public static String date2Str(Date date, String dateFormat) {
        if (date == null) {
            return null;
        }
        SimpleDateFormat df = new SimpleDateFormat(dateFormat);
        return df.format(date);
    }
}

Related

  1. date2Str(Calendar c, String format)
  2. date2Str(Date aDate)
  3. date2Str(Date date)
  4. Date2Str(Date date)
  5. date2Str(Date date)
  6. date2Str(Date date, String format)
  7. date2Str(Date date, String format)
  8. date2Str(Date date, String partten)
  9. date2Str(Date date, String pattern)