Thymeleaf: get the current year

The following code returns the current year on Thymeleaf:


Example usage

Create a list of options from 1900 up to the current year:

<select >
  <option th:each="year : ${#numbers.sequence(1900, #dates.year(#dates.createNow()))}"
      th:value="${year}" th:text="${year}">


Category BootstrapCategory CoffeescriptCategory DrupalCategory GravCategory HTMLCategory JavascriptCategory JoomlaCategory jQueryCategory LaravelCategory MagentoCategory PHPCategory SharePointCategory SpringCategory ThymeleafCategory WordPressCategory Workflow


Developed and designed by Netgloo
© 2019 Netgloo