Here you can find the source of getYearMonth(Calendar sDate)
public static String getYearMonth(Calendar sDate)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static String getYearMonth(Calendar sDate) { if (sDate == null) return ""; return (new java.text.SimpleDateFormat("yyyy-MM")).format(sDate .getTime());/*from ww w . j ava 2s .c o m*/ } }