[Tutor] Getting Date/Time from a file and using it in calculations

dgj502 at york.ac.uk dgj502 at york.ac.uk
Thu Aug 16 02:49:58 CEST 2007


Hello there

Messing around with certain time and datetime objects, I have managed to 
subtract a date/time from the present time thusly:

from time import *
import datetime

one = datetime.datetime.now()
two  = datetime.datetime(2007, 8, 29, 11, 15, 00)

difference = one - two

print difference

However, I have to take a date from a file and then insert it to where two 
should be, however to no success. I have managed to get a string containing 
the above date/time, but that is as far as I've gotten without it not 
working.

Does anyone have any ideas on how to do this properly?  

Also I wish to display the result only in seconds left, rather than the 
current result, which just displays days/hours/minutes/seconds/milliseconds 
left, but am again struggling to progress.

Any help would be amazingly appreciated :)

Thanks again

-Dave


More information about the Tutor mailing list