Calendar Class

It is a predefined class in java.util package.it is used to get date and time along with other internal time and date properties of Calendar
The main difference between date and Calendar class is date always represents current system date amd time. Where as Calendar class can be used to get the date ,time and other properties in a complete Calendar year(from january to december).
Syntax:

Calendar c=Calendar.getInstance();

In the above syntax getInstance() is a predefined method of a Calendar class.Which returns Calendar class object.
Program: 
import java.util.*;

public class Rain {

	public static void main(String[] args)  {
		Calendar c1=Calendar.getInstance();
		System.out.println("Current date");
		int dd=c1.get(Calendar.DATE);
		int mm=c1.get(Calendar.MONTH);
		mm++;
		int yy=c1.get(Calendar.YEAR);
		System.out.println(dd+"-"+mm+"-"+yy);
		System.out.println("Current Time");
		int h=c1.get(Calendar.HOUR);
		int m=c1.get(Calendar.MINUTE);
		int s=c1.get(Calendar.SECOND);
		System.out.println(h+":"+m+":"+s);
		int x=c1.get(Calendar.AM_PM);
		if(x==0)
		{
			System.out.println("AM");
			System.out.println("Good Morning");
		}
		else
		{
			System.out.println("PM");
			System.out.println("Good Evening");
		}
		int dw=c1.get(Calendar.DAY_OF_YEAR);
		System.out.println(dw);
		
	}
	
	}

OUTPUT:
Current date
26-9-2019
Current Time
8:40:50
PM
Good Evening
269

      
Addition Program:Please execute a program in a particular time and date

import java.util.*;

public class Rain {

	public static void main(String[] args)  {
	
		Calendar c1=Calendar.getInstance();
		System.out.println("Current date");
		int dd=c1.get(Calendar.DATE);
		int mm=c1.get(Calendar.MONTH);
		mm++;
		int yy=c1.get(Calendar.YEAR);
		System.out.println(dd+"-"+mm+"-"+yy);
		System.out.println("Current Time");
		int h=c1.get(Calendar.HOUR);
		int m=c1.get(Calendar.MINUTE);
		int s=c1.get(Calendar.SECOND);
		System.out.println(h+":"+m+":"+s);
		int x=c1.get(Calendar.AM_PM);
		int p,q,r;
		Scanner ss=new Scanner(System.in);
		if(dd==28 && mm==9 && yy==2019 && h>12 && m>10 && s>0)
		{
		System.out.println("Enter p,q values");
		p=ss.nextInt();
		q=ss.nextInt();
		r=p+q;
		}
		else
		{
			System.out.println("Please execute some other time");
		}
		
		
	}
	
	}
	
OUTPUT:
Current date
27-9-2019
Current Time
11:6:21
Please execute some other time