How to get task duration when task complete

I would like to know if there’s any possible way to get the duration of the task?
I want to get the number of how long does it take to complete each task.
I already add ExecutionListener to every task but it doesn’t seem to have data that I need.

Hi, i hope it helps:
In our project we set a variable before task starts with a timer Start which is basiclly now(). and then when we execute a task we fetch it and count the difference in times.

Hi @vfongmala,

Duration (in milliseconds) is stored in camunda history data.
You can query for historic task(s) using Java or Rest APIs

Below the Rest APIs docs for “Get Tasks (Historic)”
https://docs.camunda.org/manual/latest/reference/rest/history/task/get-task-query/