# Job Duration/execution end time

**URL:** <https://discuss.hangfire.io/t/job-duration-execution-end-time/4452>\
**Category:** question\
**Created:** [March 11, 2018, 7:50pm UTC](https://discuss.hangfire.io/t/job-duration-execution-end-time/4452 "2018-03-11T19:50:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spock](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@Spock](https://discuss.hangfire.io/u/Spock)\
**Post date:** [March 11, 2018, 7:50pm UTC](https://discuss.hangfire.io/t/job-duration-execution-end-time/4452/1 "2018-03-11T19:50:37Z")

</div>

is there any method to get the exact execution end time or even the job duration plus the job start time ?

---

<div class="post-metadata">

**Author:** ![pieceofsummer](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/pieceofsummer/32/785_2.png) [@pieceofsummer](https://discuss.hangfire.io/u/pieceofsummer)\
**Post date:** [March 13, 2018, 7:54pm UTC](https://discuss.hangfire.io/t/job-duration-execution-end-time/4452/2 "2018-03-13T19:54:56Z")

</div>

Depending on what exactly you want to achieve.

For example, the following code snippet will calculate duration between job creation date and last state (e.g. Succeeded) creation date:

```auto
IMonitoringApi monitoringApi = JobStorage.Current.GetMonitoringApi(); // or whatever
JobDetailsDto job = monitoringApi.JobDetails(jobId);
TimeSpan duration = job.History[0].CreatedAt - job.CreatedAt;

```

This is just an example. In the real world, the job might have no history records at all (you need to check that), or have multiple Succeded/Failed states in history (if the job was requeued because of errors etc.).
