-1

I am calling a function to download a file from sharepoint and upload to sql server database. I am logging the information success and failure in a table. how can i calculate total time that takes during the execution of this function?

like:

start_time=datetime.now()
function call 
end_time=datetime.now()
total=end_time-start_time

please suggest the working query, i am running out of time.

James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

Here's a way to get it done:

Code:

from datetime import datetime

st = datetime.now()

#call your function here

et=datetime.now()
print('\nTotal time for execution : {}'.format(et-st).split(".")[0])

Output:

Total time for execution : 0:00:00
Gary
  • 909
  • 8
  • 20