# Get total episode duration in PHP templates

**URL:** <https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526>\
**Category:** Podlove Publisher\
**Created:** [March 19, 2016, 1:56pm UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526 "2016-03-19T13:56:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolasschabram](https://community.podlove.org/user_avatar/community.podlove.org/nicolasschabram/32/717_2.png) [@nicolasschabram](https://community.podlove.org/u/nicolasschabram)\
**Post date:** [March 19, 2016, 1:56pm UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526/1 "2016-03-19T13:56:56Z")

</div>

Hey there,

according to the [documentation](http://docs.podlove.org/podlove-publisher/reference/template-tags.html#duration), it should be possible to retrieve the total duration of an episode this way in a PHP template:

```
$episode = \Podlove\get_episode();
$episode->duration()->totalMilliseconds();

```

For some reason, this doesn’t do the job in my case. It works fine with hours(), minutes(), seconds(), and milliseconds(). It just won’t return nothing for totalMilliseconds().

Is it me or is this a bug?

Thanks for your help!  
Nicolas

---

<div class="post-metadata">

**Author:** ![ericteubert](https://community.podlove.org/user_avatar/community.podlove.org/ericteubert/32/1568_2.png) [@ericteubert](https://community.podlove.org/u/ericteubert)\
**Post date:** [March 20, 2016, 5:16am UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526/2 "2016-03-20T05:16:58Z")

</div>

It’s a bug, and it applies to Twig templates as well.

Will be fixed in next release [https://github.com/podlove/podlove-publisher/commit/02c8b8f7811eaf801474d535b7f1add7583c5334](https://github.com/podlove/podlove-publisher/commit/02c8b8f7811eaf801474d535b7f1add7583c5334)

---

<div class="post-metadata">

**Author:** ![nicolasschabram](https://community.podlove.org/user_avatar/community.podlove.org/nicolasschabram/32/717_2.png) [@nicolasschabram](https://community.podlove.org/u/nicolasschabram)\
**Post date:** [July 22, 2016, 7:05pm UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526/3 "2016-07-22T19:05:11Z")

</div>

Hey Eric,

this still isn’t fixed in the current release, is it? If I get it right it will be part of 2.4.0. Would it also be possible to already include the changes in 2.3.13?

Thank you!  
Nicolas

---

<div class="post-metadata">

**Author:** ![Joey](https://community.podlove.org/user_avatar/community.podlove.org/joey/32/1080_2.png) [@Joey](https://community.podlove.org/u/Joey)\
**Post date:** [July 23, 2016, 12:18pm UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526/4 "2016-07-23T12:18:52Z")

</div>

I feel like there won’t be a 2.3.13 (100% speculation). I think 2.4 is the next version we’ll see.

---

<div class="post-metadata">

**Author:** ![ericteubert](https://community.podlove.org/user_avatar/community.podlove.org/ericteubert/32/1568_2.png) [@ericteubert](https://community.podlove.org/u/ericteubert)\
**Post date:** [July 23, 2016, 1:27pm UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526/5 "2016-07-23T13:27:04Z")

</div>

@Joey Probably. I will only release 2.3.13 if any critical (security/WordPress update compatibility) issues appear before 2.4.

@nicolasschabram feel free to apply the change to the file on your system until then 🙂

---

<div class="post-metadata">

**Author:** ![ericteubert](https://community.podlove.org/user_avatar/community.podlove.org/ericteubert/32/1568_2.png) [@ericteubert](https://community.podlove.org/u/ericteubert)\
**Post date:** [August 14, 2016, 11:02am UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526/6 "2016-08-14T11:02:41Z")

</div>

Changed my mind: [2.3.13](https://community.podlove.org/t/release-2-3-13/664) was just released and includes the fix for this issue.

---

<div class="post-metadata">

**Author:** ![nicolasschabram](https://community.podlove.org/user_avatar/community.podlove.org/nicolasschabram/32/717_2.png) [@nicolasschabram](https://community.podlove.org/u/nicolasschabram)\
**Post date:** [August 14, 2016, 7:30pm UTC](https://community.podlove.org/t/get-total-episode-duration-in-php-templates/526/7 "2016-08-14T19:30:46Z")

</div>

Great, thank you! 🙂
