Java Date Format formatDate(Date date)

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

Description

Converts the given Date instance to string.

License

Open Source License

Parameter

Parameter Description
date the date to be formatted

Return

the formatted date (not null)

Declaration

private static String formatDate(Date date) 

Method Source Code

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

public class Main {
    /**//from  w  w w. j  av  a  2 s  . co  m
     * Represents date format to convert Date instance into String representation.
     */
    private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";

    /**
     * Converts the given Date instance to string.
     * @param date the date to be formatted
     * @return the formatted date (not null)
     */
    private static String formatDate(Date date) {
        return (new SimpleDateFormat(DATE_FORMAT)).format(date);
    }
}

Related

  1. formatDate(Date date)
  2. formatDate(Date date)
  3. formatDate(Date date)
  4. formatDate(Date date)
  5. formatDate(Date date)
  6. formatDate(Date date)
  7. formatDate(Date date)
  8. formatDate(Date date)
  9. formatDate(Date date)