开发者

Human friendly date logic library in java

开发者 https://www.devze.com 2023-02-13 01:04 出处:网络
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 s

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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消