Skip to content
Zotonic
  • Start
  • Cookbook
  • Reference
  • Releases

Live search

Search across all Zotonic content

Type at least two characters

Results are matched against titles, summaries and topics as you type.

Filters ยท mod_base
  • Reference
  • Frontend developer
  • Template filter
  • Format
  • Duration

format_duration

Module

mod_base

Show a duration in hours, minutes and seconds.

Takes as input a number representing a number of seconds. Outputs a human readable form.

For example:

{{ 123|format_duration }}

Will ouput 2m3s.

And:

{{ 3601|format_duration }}

Will ouput 1h0m1s.

Edit on GitHub

Related documentation

Filters

timesince

Show a readable version of a date/time difference.

Filters

media_exif_value

Formats EXIF values for display in templates.

Filters

format_dispatch_path_element

Format dispatch path element so variables will be more visible.

Filters

format_dispatch_controller_option

Format dispatch controller options.

Filters

upper

Translates the value to upper case.

Filters

date

Formats a date or datetime according to the format specified in the argument.

Filters

language_dir

Return rtl or ltr depening on the direction of the language.

Filters

capfirst

Converts the first character of the value to uppercase.

Filters

lower

Translates the value to lower case.

GitHub © 2026 Zotonic