I don't think that will do it. The date stored in the database would be
10/15/1980, or 10/21/1993.

Those should both show a birthday in the month of August. But, I don't want
just a matching month. I want it for the next 30 days.

So, on December 15th I should see all birthdays between December 15th and
January 15th regardless of what year the birthday is in.

Jim


On Oct 3, 2017 6:22 PM, "Limedrop" <russ...@holtrd.com> wrote:

> It just works.  For example:
>
>     import datetime
>     now = datetime.datetime.now()
>     last_date = now + datetime.timedelta(days=settings.days_to_include)
>     query = (db.person.interview_datetime < last_date)
>     rows = db(query).select()
>
>
> On Wednesday, 4 October 2017 10:38:38 UTC+13, Jim S wrote:
>>
>> Stifan
>>
>> I use that method to build dates quite often.  However, I don't know how
>> to translate that into a DAL query.
>>
>> -Jim
>>
>> On Tuesday, October 3, 2017 at 4:18:30 PM UTC-5, 黄祥 wrote:
>>>
>>> perhaps you can use python datetime module.
>>> e.g.
>>> import datetime
>>> print (datetime.date.today() + datetime.timedelta(1*365/12)).isoformat()
>>>
>>> or
>>>
>>> from datetime import date
>>> from dateutil.relativedelta import relativedelta
>>> six_months = date.today() + relativedelta(months=+1)
>>>
>>> The advantage of the latest approach is that it takes care of issues
>>> with 28, 30, 31 days etc.
>>>
>>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/-mKujQj0oB4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to