Java Date Format dateFormatted(Date date)

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

Description

Returns the date with the format yyyy/MM/dd HH:mm:ss.

License

Apache License

Parameter

Parameter Description
date The date to format.

Return

The String of the date with the format yyyy/MM/dd HH:mm:ss

Declaration

public static String dateFormatted(Date date) 

Method Source Code


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

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

public class Main {
    /**/*from  www  .j  a v a 2  s .c  om*/
     * Returns the date with the format yyyy/MM/dd HH:mm:ss. If the parameter is
     * null, return a empty string.
     * 
     * @author mgimenez
     * @param date
     *            The date to format.
     * @return The String of the date with the format yyyy/MM/dd HH:mm:ss
     */
    public static String dateFormatted(Date date) {
        String result = "";
        if (date != null) {
            result = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date);
        }
        return result;
    }
}

Related

  1. dateFormatCheck(String source)
  2. dateFormatCheck(String source, String format)
  3. dateformate(String reg, Date newdate)
  4. dateFormater(String dataStr, String dataFormat)
  5. dateFormatString(Date date)
  6. dateFormatter(String dateFormat)
  7. dateFormatTime(final Date date)
  8. dateFormatToString(Date date, String format)
  9. dateFormatToString(String source, String format)