DateFormat getDateInstance() Method in Java with Examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report DateFormat class of java.text package is an abstract class that is used to format and parse dates for any locale. It allows us to format date to text and parse text to date. DateFormat class provides many functionalities to obtain, format, parse default date/time. Note: DateFormat class extends Format class that means it is a subclass of Format class. Since DateFormat class is an abstract class, therefore, it can be used for date/time formatting subclasses, which format and parses dates or times in a language-independent manner. Package-view: java.text Package DateFormat Class getDateInstance() Method getDateInstance() Method of DateFormat class in Java is used to get the date formatter. This date formatter comes with the default formatting style for a default locale. Syntax: public static final DateFormat getDateInstance() Return Type: Returns a date formatted in a particular format. Example 1: Java // Java Program to Illustrate getDateInstance() Method // of DateFormat Class // Importing required classes import java.text.*; import java.util.*; // Main class public class GFG { // Main driver method public static void main(String[] argv) { // Initializing the first formatter // using getDateInstance() method DateFormat DFormat = DateFormat.getDateInstance(); System.out.println("Object: " + DFormat); // Formatting the string String str = DFormat.format(new Date()); // Printing the string date on console System.out.println(str); } } Output: Object: java.text.SimpleDateFormat@ce9bf0a5 Mar 27, 2019 Example 2: Java // Java Program to Illustrate getDateInstance() Method // of DateFormat Class // Importing required classes import java.text.*; import java.util.*; // Main class public class GFG { // Main driver method public static void main(String[] args) throws InterruptedException { // Initializing SimpleDateFormat by // creating object of SimpleDateFormat class SimpleDateFormat SDFormat = new SimpleDateFormat("MM/dd/yyyy"); // Printing the formats Date date = new Date(); String str_Date1 = SDFormat.format(date); // Displaying the original date System.out.println("The Original: " + (str_Date1)); // Initializing the Date formatter DateFormat DFormat = DateFormat.getDateInstance(); System.out.println("Object: " + DFormat); // Formatting the string String str = DFormat.format(new Date()); // Printing the string date on console System.out.println(str); } } OutputThe Original: 01/11/2022 Object: java.text.SimpleDateFormat@ad508834 Jan 11, 2022 Comment More infoAdvertise with us Next Article DateFormat getDateTimeInstance() Method in Java with Examples C chinmoy lenka Follow Improve Article Tags : Misc Java Java-Functions Java-text package Java-DateFormat +1 More Practice Tags : JavaMisc Similar Reads DateFormat getDateTimeInstance() Method in Java with Examples DateFormat class of java.text package is an abstract class that is used to format and parse dates for any locale. It allows us to format date to text and parse text to date. DateFormat class provides many functionalities to obtain, format, parse default date/time. Note: DateFormat class extends Form 2 min read DateFormat getDateTimeInstance() Method in Java with Examples DateFormat class of java.text package is an abstract class that is used to format and parse dates for any locale. It allows us to format date to text and parse text to date. DateFormat class provides many functionalities to obtain, format, parse default date/time. Note: DateFormat class extends Form 2 min read DateFormat getTimeInstance() Method in Java with Examples DateFormat class of java.text package is an abstract class that is used to format and parse dates for any locale. It allows us to format date to text and parse text to date. DateFormat class provides many functionalities to obtain, format, parse default date/time. Note: DateFormat class extends Form 2 min read DateFormat getTimeInstance() Method in Java with Examples DateFormat class of java.text package is an abstract class that is used to format and parse dates for any locale. It allows us to format date to text and parse text to date. DateFormat class provides many functionalities to obtain, format, parse default date/time. Note: DateFormat class extends Form 2 min read Java DateFormat getInstance() Method with Examples The getInstance() method of DateFormat class will return the date and time formatter with the default formatting style for the default locale. Syntax: public static final DateFormat getInstance() Parameter: This method doesn't require any parameters. Return value: This method will return the date fo 2 min read DateFormat getCalendar() Method in Java with Examples The getCalendar() Method of DateFormat class in Java is used to get the calendar associated with this date/time format object. Syntax: public Calendar getCalendar() Parameter: The method does not take any parameters. Return Value: The method returns an instance of Calendar for this DateFormat object 2 min read Like