On 9/11/07, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2007-09-11, Shawn Milochik <[EMAIL PROTECTED]> wrote:
>
> > I have done what I wanted, but I think there must be a much better way.
>
> See the strptime() function in either the time or the datetime
> modules:
>
> http://docs.python.org/lib/module-time.html
> http://docs.python.org/lib/module-datetime.html
>


Grant:

Thanks, this works, and is much shorter. Any further improvements, anyone?

def isOld(lastUpdate, runTimeStamp):

   oneDay = 60 * 60 * 24

   lastUpdate = time.mktime(time.strptime(lastUpdate, "%Y-%m-%d_%H:%M"))
   runTimeStamp = time.mktime(time.strptime(runTimeStamp, "%Y-%m-%d_%H:%M"))

   return (runTimeStamp - lastUpdate) / oneDay
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to