Date Month name and number format(%tB %tb %tm)
import java.util.Calendar;
import java.util.Formatter;
public class MainClass {
public static void main(String args[]) {
Formatter fmt = new Formatter();
Calendar cal = Calendar.getInstance();
fmt = new Formatter();
fmt.format("%tB %tb %tm", cal, cal, cal);
System.out.println(fmt);
}
}
Output:
June Jun 06
Home
Java Book
Runnable examples
Java Book
Runnable examples
Formatter:
- Date Complete time and date format(%tc)
- Date hour and minute format(%tl:%tM)
- Date Month name and number format(%tB %tb %tm)
- Date Standard 12-hour time format(%tr)