Thymeleaf is a widely-used template engine designed for Java applications. The engine comes with awesome helpers that could be helpful in data manipulation. In this article, we will present utility methods for
java.util.Calendar object. The implementation of
Calendar utility methods can be found in the official Thymeleaf GitHub Repository.
2. Available utility methods for
Thymeleaf provides several methods to manipulate java.util.Calendar object directly on the template. Calendar method are very similar to those available for
java.util.Date object. You can go and check
Thymeleaf utility methods for Dates.
||Format calendar with the standard locale format||Also works with arrays, lists or sets|
||Format calendar with the ISO8601 format||Also works with arrays, lists or sets|
||Format calendar with the specified pattern||Also works with arrays, lists or sets|
||Obtain calendar properties|
||Create calendar (java.util.calendar) objects from its components|
||Create a calendar (java.util.calendar) object for the current date and time|
||Create a calendar (java.util.Calendar) object for the current date (time set to 00:00)|
In this article, we presented Thymeleaf utility methods for
java.util.Calendar objects. Methods can be used to format dates and creating a new instance of a Date object directly on the template. Utility methods for
Calendar are very similar to methods for
Date objects. Use them accordingly to your needs.