Java Month Format formatMonth(Date date)

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

Description

format Month

License

Open Source License

Declaration

public static String formatMonth(Date date) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public final static String monthFormat = "yyyyMM";

    public static String formatMonth(Date date) {
        if (date == null) {
            return null;
        }// w ww .ja v  a  2s . com

        return new SimpleDateFormat(monthFormat).format(date);
    }

    public static String format(Date date, String format) {
        if (date == null) {
            return null;
        }
        return new SimpleDateFormat(format).format(date);
    }
}

Related

  1. addMonths(String src, int addMonth, String format)
  2. formatMonth(Date date)
  3. formatMonth(final Date date)
  4. formatMonth(final int year, final int month)
  5. formatMonth(int month)