- Trending Categories
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
Display Date in E MMM dd yyyy format in Java
Firstly, import the following Java packages −
import java.text.SimpleDateFormat; import java.util.Date;
Now, create objects −
Date dt = new Date(); SimpleDateFormat dateFormat;
Displaying date in the format we want
dateFormat = new SimpleDateFormat("E MMM dd yyyy");
The following is an example −
Example
import java.text.SimpleDateFormat; import java.util.Date; public class Demo { public static void main(String args[]) { Date dt = new Date(); SimpleDateFormat dateFormat; dateFormat = new SimpleDateFormat("E MMM dd yyyy"); System.out.println("Date: "+dateFormat.format(dt)); } }
Output
Date: Thu Nov 22 2018
Advertisements