On Thu, 2007-05-10 at 11:52 -0700, [EMAIL PROTECTED] wrote: > I'm sure there is a hack for doing something like what you suggest, > but it would be messy. The problem is that I get a datetime object > returned and division really isn't something you can do to one of > those objects. Besides, if I had seconds returned, I would want to > multiply by 60, not divide.
If you subtract that datetime object from the current datetime, you'll get a timedelta object that gives you the number of days and seconds (and microseconds, if you care) between the two datetimes: >>> import datetime >>> dt1 = datetime.datetime(2007,5,1,12,0,0) >>> dt2 = datetime.datetime.now() >>> delta = dt2 - dt1 >>> delta.days 9 >>> delta.seconds 11219 Now, if 60 seconds are one minute, 11219 seconds are how many minutes? (Answer left as an exercise for the reader.) Hope this helps, -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list