Java Program to Print the Months in Different Formats Last Updated : 23 Mar, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report For printing months in different formats, we are going to use two classes of java.util package. That is the first one Calendar class and another one is Formatter class. From Calendar class use getInstance() method to get instance (time and date information) of calendar according to the current time zone. Example: Input : 18-11-2020 Output: December Dec 12 Explanation: Here, month starts from 0. Input : 18-5-2019 Output: June Jun 06 Syntax: public static Calendar getInstance() Return Value: The method returns the calendar. Formatter Class: Formatter class in java is mainly used to displaying a number, string, time, date any format you like. Following are the conversion characters are used for formatting dates in our program. %tB- Full month name like "January" "March".%tb-Abbreviated month name like "Jan", "Feb".%tm-Months formatted as two digits.The format used in the below implementation: "November" "NOV" "11" Implementation: Java // Java Program to Print the Months in Different Formats import java.util.Calendar; import java.util.Formatter; public class MonthFormates { public static void main(String args[]) { // create objects of date formatter class. Formatter fmt1 = new Formatter(); // create object of calendar class. // cal object contains current date of system Calendar cal = Calendar.getInstance(); // setting a new date and Here 5 means // June because Months starts from 0 cal.set(2019, 5, 18); // print month in different ways. fmt1.format("%tB %tb %tm", cal, cal, cal); System.out.println("Output: " + fmt1); } } OutputOutput: June Jun 06 Comment More infoAdvertise with us Next Article How to convert Date to String in Java P patildhanu4111999 Follow Improve Article Tags : Java Technical Scripter Java Programs Technical Scripter 2020 Java-Date-Time +1 More Practice Tags : Java Similar Reads Java Program to Display Name of a Month in (MMM) Format Java is a most powerful programming language, by which we can do many things and Java is an industry preferable language. So it has a huge field of features. Here we discuss one of the best features of Java, that is how we can represent Month in a short form or MMM Format. There are two ways to do t 3 min read Java Program Format Time in MMMM Format In Java, The MMM format for months is a short form of the month using 3 characters. SimpleDateFormat class is used for implementing this format in java and you can import this package by using the following code. import java.text.SimpleDateFormat Example: Months Name(MMMM Format)MMM FormatJanuaryJan 2 min read Java Program to Display Name of Months of Calendar Year in Short Format As we know that in a calendar year, there are a total of 12 Months. In order to convert the name of months to a shorter format, there are basically two ways, ie we can either make use of DateFormatSymbols class or SimpleDateFormat class. These classes have methods that are used to convert the names 3 min read Java Program to Display Dates of a Calendar Year in Different Format As different countries do opt for different formats. So here the goal is simply to print dates of calendar in different years. The generic symbolic notation opted across the globe is: Symbolic NotationDepictsyyearMmonth in year dday in month Eday of week Concept: Whenever it comes down to the date a 4 min read How to convert Date to String in Java Given a date, the task is to write a Java program to convert the given date into a string. Examples: Input: date = "2020-07-27" Output: 2020-07-27 Input: date = "2018-02-17" Output: 2018-02-17 Method 1: Using DateFormat.format() method Approach: Get the date to be converted.Create an instance of Sim 3 min read Java Program to Display Name of the Weekdays in Calendar Year Concept: In java when it comes down to the date and time problems after hitting the brute force method one should always remember the Date class of java which not only provides to print current or forthcoming year, month, day, date, time, hour, minutes, and even precision to seconds. Not only one ca 5 min read Like