Java yyyy format(Date date)

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

Description

format

License

Open Source License

Declaration

public static String format(Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static String YYYY_MM_DD = "yyyy-MM-dd";

    public static String format(Date date, String pattern) {
        if (date == null)
            return "";
        else//from  ww  w  .j  a v  a2  s  .com
            return getFormatter(pattern).format(date);
    }

    public static String format(Date date) {
        if (date == null)
            return "";
        else
            return getFormatter(YYYY_MM_DD).format(date);
    }

    private static SimpleDateFormat getFormatter(String parttern) {
        return new SimpleDateFormat(parttern);
    }
}

Related

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