- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
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
Advertisements