如何将Grails中的日期时间字段转换为日期,无需捕获时间?我需要做这个与系统日期比较。转换datetime到日期
class Trip
{
String name
String city
Date startDate
Date endDate
String purpose
String notes
static constraints = {
name(maxLength: 50, blank: false)
startDate(validator: {return (it >= new Date())}) // This won't work as it compares the time as well
city(maxLength: 30, blank: false)
}
}
似乎是我正在寻找的解决方案,但是由于一些奇怪的原因,它不起作用。即使在添加新类后,验证仍不起作用。有什么我失踪?谢谢 – Omnipotent 2008-12-09 05:32:27
嗯......它怎么“不工作?”我的意思是,控制台上是否有错误,警告或消息?它只是没有调用验证?验证是否返回“误报?” – 2008-12-09 17:39:21