I now it was posted a long time ago, but there are a simpler solution:
dt = request.now.date()
rows = db(
(db.events.created_on.date()==dt)
).select()
Em sábado, 16 de julho de 2011 09:25:57 UTC-3, AngeloC escreveu:
>
> > that "dirty hack" fails for the MSSQL adapter in 1.97.1:
>
> Well
> that "dirty hack" fails for the MSSQL adapter in 1.97.1:
Well yes, I called it a dirty hack!
I'm looking for a function to extract date and time from a datetime db
side and I think I found one for every database supported by the DAL,
I'm in the process of review my research.
I'm intrugued in t
Hi Angelo,
On Jul 15, 12:12 pm, Angelo Compagnucci
wrote:
> Hi Denes,
>
> thank you for your time!
>
> row.data.date() could be the solution to the problem, but it forces me
> to traverse the table returned by the query and build another table
> with dates instead of datetimes... Not the best sol
Hi Denes,
thank you for your time!
row.data.date() could be the solution to the problem, but it forces me
to traverse the table returned by the query and build another table
with dates instead of datetimes... Not the best solution in speed and
elegance!
I think that a query like the one I made i
Hi Angelo,
sorry, I missed the datetime in the title (duh!).
The date function belongs to the datetime object so it would be
available in the rows only, the field does not have it:
for row in rows:
print row.data.date()
Note that the year month day hour minute second functions might not be
av
Sorry for being pedantic!
I made an empty application with only a table in the model defined as:
db.define_table('test',Field('data','datetime'))
and inserted some datetimes.
then I made a method in the controller:
def getdata():
rows = db(db.test).select()
return dict(rows=rows)
and
I believe datetime is a Python datetime.datetime object and gets validated
by IS_DATETIME().
http://docs.python.org/library/datetime.html#datetime.datetime
http://web2py.com/book/default/chapter/07?search=IS_DATETIME
Thank you Denes,
What I'm trying to do is to select the date part from a datetime as
specified in the email subject, so the AcctStartTime field is a
datetime.
I'm navigating the epydoc documentation for dal.Field
http://www.web2py.com/examples/static/epydoc/web2py.gluon.dal.Field-class.html
and
Hi Angelo,
it depends on the type of field,
date fields can be accessed directly,
e.g. dbradius.radacct.AcctStartTime
datetime fields need .date():
dbradius.radacct.AcctStartTime.date()
Denes.
On Jul 12, 1:58 pm, Angelo Compagnucci
wrote:
> Ello everybody!
>
> I'm stuck whith a really simple
9 matches
Mail list logo