4

So a question, is there a library out there that will allow me to do some datetime logic in human friendly format? For example, if I want to check if given date is within next month then I'll query submit if statement ${date} <= now + 1 month and it'll return true/false. The basic idea is do design jsp tag or function for el to do date operations and display sections of data to the client:

<bla:cond test="${datetime} <= now + 1 month">within next month</bla:cond>
<bla:cond test="${datetime} > now + 2 seconds && ${datetime} < now + 3 seconds">in 2 seconds</bla:cond>

Something like that. The idea is to have some datetime logic with easy to change/read arithmetic lexicon.

Thanks in advance.

Daniil
  • 1,398
  • 2
  • 17
  • 28

2 Answers2

9

joda-time for date arithmetic and pretty-time for human friendly display

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
3

JodaTime is usually what comes to mind. It also has a JSP tag library.

But I'd do the processing in a Controller and output only data in the JSP.

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588