Here you can find the source of getMonthlyKey(Date d)
public static String getMonthlyKey(Date d)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static String getMonthlyKey(Date d) { Calendar c = Calendar.getInstance(); c.setTime(d);//from w w w .j a v a2 s . c o m int month = c.get(Calendar.MONTH) + 1; return c.get(Calendar.YEAR) + "_" + (month < 10 ? "0" : "") + month; } }