so given this code then

def refresh_charts():
    import datetime
    charts = db(db.user_chart).select()
    for chart in charts:
       a = chart.id_chart.lastupdated
       print a.timedelta(hours=5)

why do I get an error saying 
  
object has no attribute 'timedelta'


You can probably see what I am trying to do with the code above. How should 
I do it?

On Sunday, 11 November 2012 21:17:07 UTC, viniciusban wrote:
>
> Your myrecord.datetimevalue is already a python datetime.datetime field. 
>
>
> On Sun, Nov 11, 2012 at 6:24 PM, Simon Carr <[email protected]<javascript:>> 
> wrote: 
> > What is the best way to create a python datetime object from a datetime 
> > field. i.e 
> > 
> > import datetime 
> > ... 
> > my_date_time_object = datetime.datetime(myrecord.datetimevalue) 
> > 
> > Ultimately what I want to do is add x hours to a datetime value held in 
> a 
> > field and compare the new time to datetime.now to see if it is time for 
> a 
> > file to be updated. 
> > 
> > Thanks 
> > Simon 
> > 
> > -- 
> > 
> > 
> > 
>

-- 



Reply via email to