Friday, September 5, 2025
HomeLanguagesJavaCalendar getInstance() Method in Java with Examples

Calendar getInstance() Method in Java with Examples

The getInstance() method in Calendar class is used to get a calendar using the current time zone and locale of the system.

Syntax:

public static Calendar getInstance()

Parameters: The method does not take any parameters.

Return Value: The method returns the calendar.

Below program illustrates the working of getInstance() Method of Calendar class:
Example:




// Java code to illustrate
// getGreatestMinimum() method
  
import java.util.*;
public class Java_Calendar_Demo {
    public static void main(String args[])
    {
        // Creating a calendar
        Calendar calndr = Calendar.getInstance();
  
        // Display the date and time
        System.out.print("The system"
                         + " date and time is: " + calndr.getTime());
    }
}


Reference: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#getInstance()

RELATED ARTICLES

Most Popular

Dominic
32269 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6637 POSTS0 COMMENTS
Nicole Veronica
11802 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11865 POSTS0 COMMENTS
Shaida Kate Naidoo
6752 POSTS0 COMMENTS
Ted Musemwa
7027 POSTS0 COMMENTS
Thapelo Manthata
6704 POSTS0 COMMENTS
Umr Jansen
6721 POSTS0 COMMENTS