简体   繁体   English

java中的人性化日期逻辑库

[英]Human friendly date logic library in java

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. 例如,如果我想检查给定日期是否在下个月内,那么我将查询提交if语句$ {date} <= now + 1个月,它将返回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: 基本的想法是为el设计jsp标签或函数来进行日期操作并向客户端显示数据部分:

<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和人性化显示的漂亮时间

JodaTime is usually what comes to mind. JodaTime通常是我想到的。 It also has a JSP tag library . 它还有一个JSP标记库

But I'd do the processing in a Controller and output only data in the JSP. 但我会在Controller中进行处理并仅输出JSP中的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM