Java Year Format formatYear(Date date)

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

Description

format Year

License

Open Source License

Declaration

public static String formatYear(Date date) 

Method Source Code


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

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final SimpleDateFormat DEFAULT_YEAR_FORMAT = new SimpleDateFormat("yyyy");

    public static String formatYear(Date date) {
        return format(date, DEFAULT_YEAR_FORMAT);
    }/*from   w  w  w.j a  v  a  2 s.c o  m*/

    public static String format(Date date, DateFormat format) {
        if (date == null || format == null) {
            return "";
        }
        return format.format(date);
    }
}

Related

  1. formatSlashedMmDdYy()
  2. formatTimeStampYearFirst(Date date)
  3. formatUniversalMonthYear(Date date)
  4. formatYear(Date d, Locale locale)
  5. formatYear(Date date)
  6. formatYearMonth(Date date)
  7. formatYyyyMm(Date date)
  8. formatyyyyMMddHHmmss(long time)
  9. get_Oracle_DateString_YYYYMMdd_HHmmss(java.util.Date date)