Java Date Format formatDate(Date date)

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

Description

format Date

License

Apache License

Parameter

Parameter Description

Return

the default date format in europe.

Declaration

public static String formatDate(Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static final String DATE_FORMAT = "dd/MM/yyyy";
    private static SimpleDateFormat dateFormat;

    /**//  w  ww.j  a v  a 2 s.c o m
     * @return the default date format in europe.
     * @param date: the date to format
     */
    public static String formatDate(Date date) {
        checkDateFormat();
        return dateFormat.format(date);
    }

    private static void checkDateFormat() {
        if (dateFormat == null) {
            dateFormat = new SimpleDateFormat(DATE_FORMAT);
        }
    }
}

Related

  1. formatDate(Date d)
  2. formatDate(Date d)
  3. formatDate(Date d)
  4. formatDate(Date d)
  5. formatDate(Date d, int type)
  6. formatDate(Date date)
  7. formatDate(Date date)
  8. formatDate(Date date)
  9. formatDate(Date date)