Package org.apache.commons.lang3.time
Class CalendarUtils
java.lang.Object
org.apache.commons.lang3.time.CalendarUtils
Helps use
Calendar
s.- Since:
- 3.10
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CalendarUtils
The singleton instance forCalendar.getInstance()
. -
Constructor Summary
ConstructorsConstructorDescriptionCalendarUtils
(Calendar calendar) Creates an instance for the given Calendar. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the current day of month.int
Gets the current day of year.static CalendarUtils
Creates a new instance based on the current time in the default time zone with the defaultLocale.Category.FORMAT
locale.int
getMonth()
Gets the current month.int
getYear()
Gets the current year.
-
Field Details
-
INSTANCE
The singleton instance forCalendar.getInstance()
. The instance is created when the class is initialized and is based on the current time in the default time zone with the defaultLocale.Category.FORMAT
locale.- See Also:
-
-
Constructor Details
-
CalendarUtils
Creates an instance for the given Calendar.- Parameters:
calendar
- A Calendar.
-
-
Method Details
-
getInstance
Creates a new instance based on the current time in the default time zone with the defaultLocale.Category.FORMAT
locale.- Returns:
- a new instance.
- Since:
- 3.14.0
-
getDayOfMonth
Gets the current day of month.- Returns:
- the current day of month.
-
getDayOfYear
Gets the current day of year.- Returns:
- the current day of year.
- Since:
- 3.13.0
-
getMonth
Gets the current month.- Returns:
- the current month.
-
getYear
Gets the current year.- Returns:
- the current year.
-