On Sat, 2010-02-27 at 19:13 -0800, mr.freeze wrote:
> def datesearch():
>     matches=None
>     form =
> SQLFORM.factory(Field('start_date','date',requires=IS_NOT_EMPTY()),
>  
> Field('end_date','date',requires=IS_NOT_EMPTY()))
>     if form.accepts(request.vars,session):
>         (sy,sm,sd) = (int(x) for x in form.vars.start_date.split('-'))
>         (ey,em,ed) = (int(x) for x in form.vars.end_date.split('-'))
>         query = (db.things.created_on >= datetime.date(sy,sm,sd)) &
> (db.things.created_on <= datetime.date(ey,em,ed))
>         matches = db(query).select()
>     allrows = db().select(db.things.ALL)
>     return dict(form=form,matches=matches,allrows=allrows)
> 
> 

Thanks !
That was i was looking for
The only change i made was to convert the values to datetime.datetime
type and add 23:59:59 as i was not getting the results from the end_date
due to the time.

     Ustart_Date = datetime.datetime(sy,sm,sd)
     Uend_Date = datetime.datetime(ey,em,ed,23,59,59) 


-- 
Stelios S. Koroneos

Digital OPSiS - Embedded Intelligence

Tel +30 210 9858296 Ext 100
Fax +30 210 9858298
http://www.digital-opsis.com

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to