Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
GregorianCalendar is a subclass of a Calendar that implements the most widely used Gregorian Calendar with which we are familiar.
Basic Example:
import java.util.Calendar;
import java.util.GregorianCalendar;
class CalendarAVNC {
public static void main(String[] args)
{
// Here we create an object of Calendar Class
Calendar cal = Calendar.getInstance();
/* Creating an object of GregorianCalendar Class */
GregorianCalendar gcal = new GregorianCalendar();
/* Displaying Current Date using Calendar Class */
System.out.println("Calendar date is: "+ cal.getTime());
/* Displaying Current Date using
GregorianCalendar Class */
System.out.print("Gregorian date is: "+ gcal.getTime());
} // end of main function
} // end of class