Hi there! Does anyone know how to calculate the difference between two dates? Say for example to get the number of days between today and a future calendar event that i've set or the number of weeks to go.
Hi there! Does anyone know how to calculate the difference between two dates? Say for example to get the number of days between today and a future calendar event that i've set or the number of weeks to go.
Here's one possibility. Should cope with leap years and is limited to dates in range accepted by mktime which should cover 1970 to 2038 at least.
It's a shame that datetime objects aren't implemented which would make the task easier.Code:>>> d1=(2009,1,1,0,0,0,-1,-1,-1) >>> d2=(2010,1,1,0,0,0,-1,-1,-1) >>> t1=time.mktime(d1) >>> t2=time.mktime(d2) >>> days=(t2-t1)/(60*60*24) >>> days 365.0
This is a good start http://pleac.sourceforge.net/pleac_p...sandtimes.html
Sorry for being off the radar. Im using PyS60 1.4.5 and as far as I know it doesn't support the datetime object. Is there another way out of this?
There is a new version of PyS60 available based on Python 2.5.4 which supports datetime module. Although this is a developer release, you can try it out -> https://garage.maemo.org/frs/?group_...elease_id=2673
import antigravity