- 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
Java Program to format date with System.out.format
System.out.format is used in Java to format output.
Firstly, create a Calendar object −
Calendar calendar = Calendar.getInstance();
Now, use theDate-Time conversion characters to get the date, month and year −
System.out.format("%te %tB, %tY%n", calendar, calendar, calendar);
The following is the complete example −
Example
import java.util.Locale; import java.util.Calendar; public class TestFormat { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); System.out.format("%te %tB, %tY%n", calendar, calendar, calendar); } }
Output
22 November, 2018
- Related Articles
- Different ways to format long with Java System.out.format
- Java Program to format date with SimpleDateFormat
- Java Program to format date with DateFormat.FULL
- Java Program to format date time with Join
- Java Program to parse string date value with default format
- Java Program to display date with day name in short format
- Java Program to format date in mm-dd-yyyy hh:mm:ss format
- Program to convert Milliseconds to Date Format in Java
- Format date with DateFormat.MEDIUM in Java
- Format date with DateFormat.LONG in Java
- Format date with DateFormat.SHORT in Java
- Format Date with getDateTimeInstance() in Java
- Format a message with date in Java
- PHP program to change date format
- Java Program to format time with DateFormat.MEDIUM

Advertisements