3 Mar 2008 17:42
Re: Like on DateTime using only date
Hi Gustavo, Am 03.03.2008 um 17:21 schrieb Gustavo Niemeyer: >> with at DateTime property I'd like to compare only using the date >> part. But the like method of DateTime needs a datetime.datetime >> instance, not a datetime.date instance. How can I formulate the like >> condition to only select those records whose DateTime propery match a >> datetime.date instance? > > I'm not sure I understand what's the problem you're facing. The > DateTime indeed needs a datatime object. We may extend it to support > automatic conversion from date objects, but it should be fairly simple > to make it work as it is now. > > Can you provide some sample code that is failing, and that you're > having > trouble to make it work correctly? I've the following table in MySQL: mysql> describe screenings; +----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | id | int(11) | | PRI | NULL | auto_increment | | when | datetime | YES | | NULL | | | movie_id | int(11) | YES | | NULL | | +----------+--------------+------+-----+---------+----------------+ Using Strom, the corresponding model class is:(Continue reading)
RSS Feed