Date lastModified problem

ynnr85

New member
I have a problem with my Date lastModified
My Date dateCreated is saved ok in DB, but my Date lastModified is not.
The problem is that the time in Date lastModified is always 00:00 (in gsp) and 12:00 AM (in DB)

My Domain class:
Code:
class User {
    String username    
    String password
    Date dateCreated
    Date lastModified
    Role role
    Title title
    static constraints = {
        username(blank: false, size: 4..20, unique:true)
        password(blank: false, minSize:6, password:true)
        dateCreated(nullable: true)
        lastModified(nullable: true)
    }

My gsp code:
Code:
<tr class="prop">
            <td valign="top" class="name">
              <label for="lastModified"><g:message code="user.lastModified.label" default="Last Modified" /></label>
            </td>
            <td valign="top" class="value ${hasErrors(bean: userInstance, field: 'lastModified', 'errors')}">
          <g:datePicker name="lastModified" precision="day" value="${userInstance?.lastModified}" noSelection="['': '']" />
          </td>
          </tr>
Pease help. Thanks
 

dave

Administrator
Staff member
I think you're looking for lastUpdated, not lastModified if you want it to be managed automatically. :)
 
Top