Here you can find the source of getYearMonth(Date date)
public static String getYearMonth(Date date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getYearMonth(Date date) { if (null == date) { return null; }//www . j a va 2 s . c o m SimpleDateFormat yearFormat = new SimpleDateFormat("yyyyMM"); return yearFormat.format(date); } }