Java Program to format Month in MMMM format


Set the month format as MMMM, while including the date-time format in SimpleDateFormat object.

Firstly, set the date object

Date dt = new Date();

Now, set the format for date-time

SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE MMMM dd yyyy kk:mm:ss");

Display the date with the format you want

dateFormat.format(dt)

The following is an example

Example

 Live Demo

import java.text.SimpleDateFormat;
import java.util.Date;
public class Demo {
   public static void main(String[] argv) throws Exception {
      Date dt = new Date();
      SimpleDateFormat dateFormat;
      dateFormat = new SimpleDateFormat("EEEE MMMM dd yyyy kk:mm:ss");
      System.out.println(dateFormat.format(dt));
   }
}

Output

Thursday November 22 2018 11:45:14

Updated on: 27-Jun-2020

226 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements