Java tutorial
import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] args) { Calendar cal = Calendar.getInstance(); // get the current time System.out.println("Current time is :" + cal.getTime()); Date date = new Date(); cal.setTime(date); // print the new time System.out.println("After setting Time: " + cal.getTime()); } }