4

I want to get the time delta between two timestamps: time1 and time2, and the result should be shown in millseconds. For example:

time1=17:00:00:121
time2=17:01:00:121

the result will be 60*1000=60000.

I can't find such a method in python (mostly shown in seconds), and datetime.timedelta.total_seconds() only returns seconds without the minus of minutes, hours and days.

So anyone can tell me how to make it, thanks!

Gus
  • 3,534
  • 1
  • 30
  • 39
starkshang
  • 8,228
  • 6
  • 41
  • 52

1 Answers1

1

Take a look at timedelta...

timedelta = date1 - date2

https://docs.python.org/3.2/library/datetime.html#timedelta-objects which gives you the delta in days, seconds and microseconds.

Eventually you might want to try https://docs.python.org/3.2/library/datetime.html#timedelta-objects

user3798397
  • 146
  • 5
  • http://stackoverflow.com/questions/1905403/python-timemilli-seconds-calculation thanks,there is clear answer. – starkshang Oct 06 '16 at 15:41