Here you can find the source of getMonthName(Date date)
public static String getMonthName(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static String getMonthName(Date date) { Calendar temp = Calendar.getInstance(); temp.setTime(date);// w w w. j a v a2 s .c om int y = temp.get(Calendar.YEAR); int m = temp.get(Calendar.MONTH) + 1; int d = temp.get(Calendar.DAY_OF_MONTH); int rm = 0, ry = 0; if (d >= 1 && d <= 20) { rm = m; ry = y; } if (d >= 21) { if (m == 12) { ry = y + 1; rm = 1; } else { rm = m + 1; ry = y; } } String result_str = String.valueOf(ry) + "-" + String.valueOf(rm); return result_str; } }