Java tutorial
import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] argv) { System.out.println(getMonth(new Date())); } public static Integer getMonth(Date date) { if (date == null) return 0; Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal.get(Calendar.MONTH); } }