-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.

1
  • 1
    why aren't you just using the example you already have? Commented Dec 3, 2019 at 18:56

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.