Java Date Long Format getLongDateString(Date date)

Here you can find the source of getLongDateString(Date date)

Description

yyyyMMddHHmmss

License

Open Source License

Parameter

Parameter Description
date a parameter

Declaration

public static String getLongDateString(Date date) 

Method Source Code


//package com.java2s;
import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static String longFormat = "yyyyMMddHHmmss";

    /**/*from w  w  w.j ava 2  s .c o  m*/
     * yyyyMMddHHmmss
     * 
     * @param date
     * @return
     */
    public static String getLongDateString(Date date) {
        DateFormat dateFormat = new SimpleDateFormat(longFormat);
        return formatDateString(date, dateFormat);
    }

    public static String formatDateString(Date date, DateFormat dateFormat) {
        if (date == null || dateFormat == null) {
            return null;
        }
        return dateFormat.format(date);
    }

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

Related

  1. getLongDateByMidformat(String dateStr)
  2. getLongDateCurr()
  3. getLongDateFormat(Date d)
  4. getLongDateFormatter()
  5. getLongDateStr(Date sDate)
  6. getLongDateString(Date date)
  7. getLongDateString(Date date)
  8. getLongDateString(Date date, boolean includeTime)
  9. getLongDisplayDate(Date moment, TimeZone tz, Locale inLocale)