Calendar class getInstance()method example
Calendar class getInstance()method example. This example shows you how to use getInstance()method.This method Gets a calendar using the default time zone and locale.
Here is the code:-
/**
* @Program that Gets a calendar using the default time zone and locale.
* getInstancecalender.java
* Author:-RoseIndia Team
* Date:-22-May-2008
*/
import java.util.*;
public class getInstancecalender {
public static void main(String[] args) {
//Creating calendar
Calendar c=Calendar.getInstance();
//Gets a calendar using the default time zone and locale.
System.out.print("The Current Date And Time Is: "+c.getTime());
}
} |
Output of the program:-
| The Current Date And Time Is: Thu May 22 18:34:25 IST 2008 |
|