Java Date Format As formatDateByDefault(Date date)

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

Description

format Date By Default

License

Apache License

Declaration

public static String formatDateByDefault(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

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

    public static String formatDateByDefault(Date date) {
        if (null == date) {
            return null;
        }//from w  w w.  j  ava 2s .co  m

        DateFormat df = new SimpleDateFormat(PATTERN_DEFAULT);
        String dateStr = df.format(date);

        return dateStr;
    }
}

Related

  1. formatDateAccordingToSessionDuration(Calendar cal, int sessionDuration, int offset)
  2. formatDateAppello(Date data)
  3. formatDateAsFileSystemName()
  4. formatDateAsYYYYMMDD(Date date)
  5. formatDateBdChar(Date birthdate)
  6. formatDateByYYYYMMDDHHmmss(Date date)
  7. formatDateCkan(Date date)
  8. formatDateDashes(Date oDate)
  9. formatDateDay(final Date date)