【发布时间】:2008-12-08 11:55:57
【问题描述】:
如何在不捕获时间的情况下将 Grails 中的日期时间字段转换为日期?我需要这样做以与系统日期进行比较。
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)
}
}
【问题讨论】: