Java tutorial
import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static void main(String[] args) { GregorianCalendar gc = new GregorianCalendar(); // current year value int year = gc.get(Calendar.YEAR); System.out.println(year); // current month value int month = gc.get(Calendar.MONTH); System.out.println(month); // day of month int day = gc.get(Calendar.DAY_OF_MONTH); System.out.println(day); // hour value int hour = gc.get(Calendar.HOUR); System.out.println(hour); // minute value int minute = gc.get(Calendar.MINUTE); System.out.println(minute); // second values int second = gc.get(Calendar.SECOND); System.out.println(second); } }