0

I'm working on a timing system, using Python. I am trying to work out the difference between the start time and the finish time.

startTime = 20181114171544
finishTime = 20181114182428

How can I display the difference between this dates in a nicely formatted h/m/s format?

plumby101
  • 133
  • 11
  • 1
    What did you try? Take a look at datetime from the standard library and datetime.strptime function if you haven't already. – VPfB Nov 15 '18 at 10:32
  • You have saved the date and time in an integer like this? – Klaus D. Nov 15 '18 at 10:35
  • from datetime import datetime startTime = 20181114171544 finishTime = 20181114182428 I fixed this. Repeat this for both times... y1 = int(str(startTime)[: 4]) m1 = int(str(startTime)[4: 6]) d1 = int(str(startTime)[6: 8]) h1 = int(str(startTime)[8: 10]) mi1 = int(str(startTime)[10: 12]) s1 = int(str(startTime)[12: 14]) date1 = datetime(a1, m1, d1, h1, mi1, s1) delta = date2 - date1 raceTime=time.strftime("%H:%M:%S", time.gmtime(delta.seconds)) print(raceTime) – plumby101 Nov 15 '18 at 14:11

0 Answers0