Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 grails 项目的域类中有一个 validFrom 和 validTo 日期字段。我想在其验证的基础上创建一个服务。谁能告诉我如何检查它是否大于或小于当前系统日期?
它是
Date now = new Date() if (validFrom.before(now) && validTo.after(now)) { //valid for this moment }