-3

I have a code that runs trough the facade and sum the duration of the calls that meets criteria, the call duration is on milliseconds. Today, the output is on millisecond but I want to display is on the following format hh"mm'ss.

Please advise, Nir

    sumout = 0
    x = 0
    y = 0
    for call in facade.getCalls(filter=[Call.setup_start_ts >= beg_ts, Call.setup_start_ts <= end_ts, Call.src_user == user]):
       try:
           sumout += call.call_time
           x += 1
       except TypeError:
           pass;

    facade.addResult({
                    'user':user,
                    'total_Outgoing': x,
                    'total_Outgoing_Duration': sumout,})
Cœur
  • 37,241
  • 25
  • 195
  • 267
Nir
  • 1
  • 1
  • What's your question? – Peter Wood Aug 06 '15 at 08:13
  • I don't think this is a duplicate of the first question because that one is language agnostic. It has one answer written in Python but it's buried about 20 answers deep. The second question marked as duplicate is probably still a duplicate. I'm not sure how to remove the first flag without removing the second. – Big McLargeHuge Feb 24 '21 at 19:04

1 Answers1

0

Duplicate: How to convert milliseconds into human readable form?

Another quick and dirty:

>>> print datetime.timedelta(milliseconds=465469874645)
5387 days, 9:11:14.645000
Community
  • 1
  • 1
bufh
  • 3,153
  • 31
  • 36