Java examples for java.util:Month
The month part of the Calendar date.
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static void main(String[] argv) throws Exception { Calendar c = Calendar.getInstance(); System.out.println(getMonth(c)); }//w w w .j a v a2s . c o m /** * The month part of the Calendar date. * @param c the Calendar from which to extract the month * @return The month as a String (e.g., Jul) */ public static String getMonth(Calendar c) { SimpleDateFormat f = new SimpleDateFormat("MMM"); return f.format(c.getTime()).toString(); } }