We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog

New Duration Fieldtype in ExpressionEngine 4

2/5/2018   /   By Derek Jones

Dates are not the only way we measure or describe time. Take a movie theater’s web site. The date and time that a show starts is important. But so is its length. If you’re operating a movie review site, then you probably only care about its runtime. The Duration fieldtype is just what the doctor ordered.

Duration fieldtype example

Both the input and the output options are flexible. In the example of our movie above, “The Jungle Book”, the site builder has created a Duration field with minutes as the unit of measure. The content author can enter the runtime as 106 minutes or use colon notation of 1:46, indicating 1 hour and 46 minutes. Either way, ExpressionEngine knows the total time being indicated, and the site builder could display it as:

{runtime}
{!-- 1:46 --}

Or have full control over the formatting with the format= parameter like:

{runtime format='%h hr, %m min'}
{!-- 1 hr, 46 min --}

In the field’s settings, the site builder can select either hours, minutes, or seconds as the unit of time. ExpressionEngine will cue the author in the placeholder text, so they are aware of what their input would signify. e.g. 42 hours vs. 42 minutes vs. 42 seconds. Movie and play runtimes, cooking times, travel times, cycling / running elapsed times, and more are all great fits for the new Duration fieldtype.

This article took you approximately 1m 6s / 1:06 / 1 minute and 6 seconds / 66 sec to read. ⏱

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.