1package com.tutorialspoint;
2
3import java.util.Calendar;
4
5public class CalendarDemo {
6 public static void main(String[] args) {
7
8 // create a calendar
9 Calendar cal = Calendar.getInstance();
10
11 // print current time
12 System.out.println("Current year is :" + cal.getTime());
13
14 // set the year,month and day to something else
15 cal.set(1995, 5, 25);
16
17 // print the result
18 System.out.println("Altered year is :" + cal.getTime());
19 }
20}