jexl

JEXL – Get current date and time


I have to use JEXL expression and I need to get current year and month using JEXL. Is it possible?


Solution

  • You can use JETT which allow to invoke static methods in JEXL code:

    ETT extends JEXL to allow references to static methods directly in JEXL Expressions

    Then you can call (Java 8) LocalDateTime.now method to get current date and time:

    ${java.time.LocalDateTime.now()}