Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static int getMonth() { Calendar calendar = Calendar.getInstance(); SimpleDateFormat monthSdf = new SimpleDateFormat("MM"); String monthString = monthSdf.format(calendar.getTime()); return Integer.parseInt(monthString); } }