Hi,

I have a date string in the ctime() format ('Sat Mar 5 10:38:07 2005') and I want to know how long ago that was in whole days.

So far I have:

import time
import datetime
age = (datetime.date.fromtimestamp(time.mktime(time.strptime(date.strip()))) - datetime.date.today()).days


Which is an absurd number of function calls and is possibly not even correct (something in the docs about mktime() taking localtime whereas my string is in UTC)

Any suggestions?

Thanks
MikeG
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to