Java Date Format formatDate(Date d)

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

Description

format Date

License

Open Source License

Declaration

public static String formatDate(Date d) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**// www .j  a v a  2 s .co m
     * yyyy-MM-dd
     */
    public static final String DATE_PATTERN_DEFAULT = "yyyy-MM-dd";

    public static String formatDate(Date d) {
        return format(d, DATE_PATTERN_DEFAULT);
    }

    public static String format(Date d, String pattern) {
        if (d == null)
            return null;

        SimpleDateFormat dateFromat = new SimpleDateFormat(pattern);
        return dateFromat.format(d);
    }
}

Related

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