Java examples for Date Time:Calendar
How to use Java Calendar class to display current date and time.
import java.util.Calendar; public class Main { public static void main(String[] args) { //use getInstance() method to get object of java Calendar class Calendar cal = Calendar.getInstance(); // ww w . j a va2 s. c o m //use getTime() method of Calendar class to get date and time System.out.println("Today is : " + cal.getTime()); } }