sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #34390
[Question #270830]: How to get difference of 2 dates in python
New question #270830 on Sikuli:
https://answers.launchpad.net/sikuli/+question/270830
Hello,
I want to get difference of time span of 2 different times.
one of the time, which I obtain as string (Here I gave manual input)
second time is local time.
Here is my code :
from time import strptime
from time import localtime
from datetime import date
from datetime import datetime
out="20150827173103"
time1=datetime(time.strptime(out,"%Y%m%d%H%M%S"))
print(time1)#string converted into time format#
time2=time.strftime("%Y%m%d%H%M%S")
print(time2)#got local time in string format#
time3=datetime(time.strptime(time2,"%Y%m%d%H%M%S")#local time in string is converted into time format#
diff=time3-time1
print(diff)
I got following error
ValueError: ('year must be in 1..9999', (2015, 8, 27, 17, 31, 3, 3, 239, -1)) at 6th line.
Please suggest
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.