CodesJava

Easy learning with example program codes

Java Convert Calendar to Date


Java Convert Calendar to Date Example

package com.codesjava;
 
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
Posted in Date   
Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki