Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH) + 1; // Note that months start at 0 int day = calendar.get(Calendar.DAY_OF_MONTH);
This gets the current year, month, and day.
In summary, the java.util.Calendar class provides methods to manipulate dates and times. It is part of the java.util package. Examples include getting the current date and time, setting a specific date, and getting the year, month, and day of a date.
Java Calendar.get - 30 examples found. These are the top rated real world Java examples of java.util.Calendar.get extracted from open source projects. You can rate examples to help us improve the quality of examples.