Further more the request.now which works with the time the item is posted can also be variable with a different dates i.e if you want an item posted 1 week ago, you can use the datetime function to select the date one week ago and choose the date of deleting using timedelta(days =number) Regards
On Mon, 10 Jun 2019, 12:16 mostwanted <godirao...@gmail.com> wrote: > I am having a hard time figuring out how to calculate for variable number > of days, in my app i list job posts which have different closing dates, > what i want is for the job post to be deleted a day after its closing date. > How can achieve this with your algorithm?? > > On Sunday, June 9, 2019 at 11:47:53 AM UTC+2, Lovedie JC wrote: >> >> import datetime >> >> yesterday = request.now - datetime.timedelta(days=1) >> db(db.post.modified_on < yesterday).delete() >> >> I hope this helps. You can work around it but worked for me in deleting >> previous posts up to the previous date. You don't have to manually delete >> but works automatically. >> Regards >> >> On Sun, 9 Jun 2019 at 12:41, Lovedie JC <lbjc...@gmail.com> wrote: >> >>> Had one, let check my archives. >>> >>> On Sun, 9 Jun 2019, 09:47 mostwanted <godir...@gmail.com> wrote: >>> >>>> Is there a way to schedule an automatic deleting of content from >>>> database on a specified date? I have an application that I want to delete >>>> posts when we reach specified dates. If anyone is familiar with this, your >>>> assistance would be greatly appreciated. >>>> >>>> Regards >>>> >>>> Mostwanted >>>> >>>> -- >>>> 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 web...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/web2py/bd76a193-c425-43ca-8a7b-157bd137b860%40googlegroups.com >>>> <https://groups.google.com/d/msgid/web2py/bd76a193-c425-43ca-8a7b-157bd137b860%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/4bc7dba8-be9f-465e-958a-0eb1e07f7da7%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/4bc7dba8-be9f-465e-958a-0eb1e07f7da7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CAAcHJF9uLWZuPwEe_-bob1%2B%2BsiAJ50jK4ggfj3Hf4HYt3vvJsA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.