timestamp type in criteria...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

timestamp type in criteria...

webmediauk
Hey Guys,
I'm trying to write a criteria for getting a list of objects created on a certain day.
My domain model stores the date created as a timestamp type, so I want to get all objects with a timestamp which falls on a certain day.
I've been looking at the documentation but can't seem to find any examples?
This is as far as I have got but I can't  quite get my head around how to do this?

def c = MyModel.createCriteria()
        def modelList = c.list {
            eq("type", "form")
            and {
                between("datecreated", Date_I_Have_at_00:00, Date_I_Have_at_24:00 )
            }
        }

I think I need to manipulate the Date_I_Have maybe turn it into a Calendar but I'm not sure?

Any help would be appreciated please
Many Thanks
Barry