Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5752 Lượt xem

How Can I make this end_time = datetime.now()
in seconds only, 

I have a start_time = datetime.now() and a end_time datetime.now()

I want to find the difference in seconds. 

How can I do that in python.?


I have testet this: with start_time = datetime.now() and end_time = datetime.now()

start_time = 2016-06-30 07:15:26.273169

end_time = 2016-06-30 07:15:26.273153

Then I do a final_time = (end_time - start_time).total_seconds()

it give me this back:  float -1.6e-05

How can I convert this in hours and minutes?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

See how to do it here

http://stackoverflow.com/questions/4362491/how-do-i-check-the-difference-in-seconds-between-two-dates

Ảnh đại diện
Huỷ bỏ
Tác giả

hmm not really , I have edit my question

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 24
4406
0
thg 4 18
5620
2
thg 1 24
2619
8
thg 5 23
61383
DateTime Python Đã xử lý
4
thg 2 23
71751