>From postgresql manual: http://www.postgresql.org/docs/current/static/functions-datetime.html
SELECT EXTRACT(WEEK FROM TIMESTAMP '2001-02-16 20:38:40'); Not supported by DAL expressions, but you can use executesql... 2014-03-14 0:26 GMT+01:00 黄祥 <[email protected]>: > actually i wan to create a chart from that query : > e.g. for year and month is work this way > views/default/index.html > {{sum_sale_order = db.sale_order_header.total.sum() }} > {{query_yearly_sale_order = (db.sale_order_header.sale_order_date.year() == > request.now.year) }} > {{sum_yearly_sale_order = > db(query_yearly_sale_order).select(sum_sale_order).first()[sum_sale_order] > if db(query_yearly_sale_order).select() else 0}} > > but when it goes to week, it return and error. and pardon, i don't think > this is related with database engine, because in php it can be achieved. > e.g. OpenCart > > doing some test that work is : > {{import datetime}} > {{=datetime.date.today().isocalendar()[1]}} > {{=request.now.isocalendar()[1]}} > > all return the same week number : 11 > > but i can't get it work when i passed the datetime field value into week to > compare with the value above. > > best regards, > stifan > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

