Java program to print the months in different formats
import java.util.Calendar;
import java.util.Formatter;
public class ExMonthFormates {
public static void main(String args[]) {
// create object of date formatter class.
Formatter fmt = new Formatter();
// create object of calendar class.
Calendar cal = Calendar.getInstance();
fmt = new Formatter();
// print month in different ways.
fmt.format("%tB %tb %tm", cal, cal, cal);
System.out.println(fmt);
}
}
Output
November Nov 11