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;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static String defaultDatePattern = "yyyy-MM-dd";

    public static String format(Date date) {
        return date == null ? "" : format(date, getDatePattern());
    }//from   w w w. ja va  2s.c  o  m

    public static String format(Date date, String pattern) {
        return date == null ? "" : new SimpleDateFormat(pattern).format(date);
    }

    public static String getDatePattern() {
        return defaultDatePattern;
    }
}

Related

  1. format(Date date)
  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, String format)
  9. format(Date date, String pattern)