- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 Time in dd MMM yyyy hh:mm:ss zzz 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("dd MMM yyyy hh:mm:ss zzz");
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("dd MMM yyyy hh:mm:ss zzz"); System.out.println("Date: "+dateFormat.format(dt)); } }
Output
Date: 22 Nov 2018 07:53:58 UTC
- Related Articles
- Display Date in E MMM dd yyyy format in Java
- Java Program to format date in mm-dd-yyyy hh:mm:ss format
- SimpleDateFormat('E, dd MMM yyyy HH:mm:ss Z') in Java
- Convert MySQL date format from yyyy-mm-ddThh:mm:ss.sssZ to yyyy-mm-dd hh:mm:ss ?
- How to parse Date from String in the format: dd/MM/yyyy to dd/MM/yyyy in java?
- MySQL query to convert YYYY-MM-DD to DD Month, YYYY date format
- Accepting date strings (MM-dd-yyyy format) using Java regex?
- MySQL date format DD/MM/YYYY select query?
- How to format JavaScript date into yyyy-mm-dd format?
- Display Month in MMM format in Java
- Program to reformat date in YYYY-MM-DD format using Python
- How to format a string to date in as dd-MM-yyyy using java?
- Get today's date in (YYYY-MM-DD) format in MySQL?
- Get date format DD/MM/YYYY with MySQL Select Query?
- MySQL date format to convert dd.mm.yy to YYYY-MM-DD?

Advertisements