On Monday 01 December 2008 9:01:11 pm Bobby Roberts wrote:
> > http://www.python.org/doc/2.5.2/lib/datetime-timedelta.html
>
> yeah.... i said I don't understand this.

I found datetimes easier to deal with when I used the modules found here:
http://labix.org/python-dateutil

As as an example for the first value in you post you can get a datetime as 
follows:

from dateutil.parser import *
hittime= parse("2008-12-01 22:02:59")
hittime
datetime.datetime(2008, 12, 1, 22, 2, 59)

nowtime=datetime.datetime.now()

I wrote a simple function to extract the seconds from two datetimes:

def timeDiff(dt_1,dt_2):
  """Calculate time difference between two datetimes.
  
  """
  print 'dt_1 = '+ str(dt_1)
  print 'dt_2 = '+ str(dt_2)
  dt_diff = dt_2 - dt_1
  days = dt_diff.days
  print 'Days= '+str(days)
  seconds = dt_diff.seconds
  print 'Seconds= '+str(seconds)
  total_secs = (days * 86400) + seconds
  return total_secs

So:
timeclkfunc.timeDiff(hittime,n)
dt_1 = 2008-12-01 22:02:59
dt_2 = 2008-12-01 22:32:47.391199
Days= 0
Seconds= 1788
Out[17]: 1788


-- 
Adrian Klaver
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to