CalendarUtils¶
Constructors¶
Creates an instance for the given Calendar. |
Fields and constants¶
The singleton instance for |
- public static final CalendarUtils INSTANCE[source]¶
The singleton instance for
Calendar#getInstance(). The instance is created when the class is initialized and is based on the current time in the default time zone with the defaultCategory#FORMATlocale.- See also:
Methods¶
Gets the current day of month. |
|
Gets the current day of year. |
|
Gets a new instance based on the current time in the default time zone with the default |
|
Gets the current month. |
|
Gets the current year. |
|
Converts this instance to a |
|
Converts this instance to a |
|
Converts a Calendar to a LocalDateTime. |
|
Converts this instance to a |
|
Converts a Calendar to an OffsetDateTime. |
|
Converts this instance to a |
|
Converts a Calendar to a ZonedDateTime. |
- public int getDayOfMonth()[source]¶
Gets the current day of month.
- Returns:
The current day of month.
- public int getDayOfYear()[source]¶
Gets the current day of year.
- Returns:
The current day of year.
- Since:
3.13.0
- public static CalendarUtils getInstance()[source]¶
Gets a new instance based on the current time in the default time zone with the default
Category#FORMATlocale.- Returns:
A new instance.
- Since:
3.14.0
- public LocalDate toLocalDate()[source]¶
Converts this instance to a
LocalDate.- Returns:
A LocalDate.
- Since:
3.18.0
- public LocalDateTime toLocalDateTime()[source]¶
Converts this instance to a
LocalDateTime.- Returns:
A LocalDateTime.
- Since:
3.17.0
- public static LocalDateTime toLocalDateTime(Calendar calendar)[source]¶
Converts a Calendar to a LocalDateTime.
- Parameters:
calendar – The Calendar to convert.
- Returns:
A LocalDateTime.
- Since:
3.17.0
- public OffsetDateTime toOffsetDateTime()[source]¶
Converts this instance to a
OffsetDateTime.- Returns:
A OffsetDateTime.
- Since:
3.17.0
- public static OffsetDateTime toOffsetDateTime(Calendar calendar)[source]¶
Converts a Calendar to an OffsetDateTime.
- Parameters:
calendar – The Calendar to convert.
- Returns:
A OffsetDateTime.
- Since:
3.17.0
- public ZonedDateTime toZonedDateTime()[source]¶
Converts this instance to a
ZonedDateTime.- Returns:
A ZonedDateTime.
- Since:
3.17.0
- public static ZonedDateTime toZonedDateTime(Calendar calendar)[source]¶
Converts a Calendar to a ZonedDateTime.
- Parameters:
calendar – The Calendar to convert.
- Returns:
A ZonedDateTime.
- Since:
3.17.0