Java Convert Calendar to Date

Java Convert Calendar to Date Example

package com.w3schools;
 
import java.util.Calendar;
import java.util.Date;
 
public class CalendarToDate {
  public static void main(String args[]){
	  try {
		  Calendar cal = Calendar.getInstance();
		  Date date = cal.getTime();
		  System.out.println(date);
	} catch (Exception e) {
		e.printStackTrace();
	}
  }
}

Output:

Mon Apr 09 23:07:09 IST 2018