# models.TimeField shown without seconds in admin

**URL:** <https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743>\
**Category:** Using Django\
**Created:** [December 18, 2020, 3:19pm UTC](https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743 "2020-12-18T15:19:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ad-software](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ad-software/32/2350_2.png) [@ad-software](https://forum.djangoproject.com/u/ad-software)\
**Post date:** [December 18, 2020, 3:19pm UTC](https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743/1 "2020-12-18T15:19:10Z")

</div>

Hi,  
I am using the models.TimeField to get the time of running results. In the form to add the time I have got hh:mm:ss and this format is stored in the database.  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/a/a40011febf54dd08702cee71a86c4b1adca93dd3.png)

But in the list in the admin area the time is only show with hh:mm. Is it possible to configure to show also the seconds?

![grafik](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/f/ff60f973c4ed7881ec83b4a6738d42eec48d3ec0.png)

Thank you  
Andreas

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 18, 2020, 7:27pm UTC](https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743/2 "2020-12-18T19:27:58Z")

</div>

See the [TIME\_FORMAT](https://docs.djangoproject.com/en/3.1/ref/settings/#time-format) setting for global settings (Also see how that relates to the USE\_L10N setting). If that’s not sufficient, then you’ll probably need to either write a custom [changelist\_view method](https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.changelist_view) or [template](https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.change_list_template).

---

<div class="post-metadata">

**Author:** ![ad-software](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ad-software/32/2350_2.png) [@ad-software](https://forum.djangoproject.com/u/ad-software)\
**Post date:** [December 22, 2020, 3:45pm UTC](https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743/3 "2020-12-22T15:45:02Z")

</div>

Thank you for the answer.  
That does not look easy. I hope to solve it.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 22, 2020, 3:53pm UTC](https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743/4 "2020-12-22T15:53:02Z")

</div>

There’s another option I just been made aware of, you could create a [custom localization file](https://docs.djangoproject.com/en/3.1/topics/i18n/formatting/#creating-custom-format-files). That looks like it might be easier.

---

<div class="post-metadata">

**Author:** ![ad-software](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ad-software/32/2350_2.png) [@ad-software](https://forum.djangoproject.com/u/ad-software)\
**Post date:** [December 23, 2020, 11:49am UTC](https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743/5 "2020-12-23T11:49:56Z")

</div>

I solved the format to show with html files.  
{{ instance.result\_value|time:“H:i:s” }}

The admin part is still in work.

---

<div class="post-metadata">

**Author:** ![ad-software](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/ad-software/32/2350_2.png) [@ad-software](https://forum.djangoproject.com/u/ad-software)\
**Post date:** [December 25, 2020, 11:45am UTC](https://forum.djangoproject.com/t/models-timefield-shown-without-seconds-in-admin/5743/6 "2020-12-25T11:45:25Z")

</div>

I have solved the display in the admin area.

```
class ResultAdmin(admin.ModelAdmin):
list_display = ('time_seconds', ....)  
def time_seconds(self, obj):
        return obj.result_value.strftime("%H:%M:%S")

```

Thank you for the help.
