An open API service indexing awesome lists of open source software.

https://github.com/webdna/secondstohms

Craft Twig Extension for converting seconds to hours, minutes, seconds
https://github.com/webdna/secondstohms

Last synced: 12 months ago
JSON representation

Craft Twig Extension for converting seconds to hours, minutes, seconds

Awesome Lists containing this project

README

          

# secondstohms
Craft Twig Extension for converting seconds to hours, minutes, seconds

To install simply place the secondstohms directory in your Craft plugins directory and install in the control panel

#### Simple Usage
```
{{ 307|secondsToHms }}

// Returns 05:07
```

#### Usage With Options
```
{{ 4000|secondsToHms({ leadingZeros: "minutes", showHours: true }) }}

// Returns 1:06:40
```

#### Options
| Option | Values | Default | Explanation |
| --------- | ----------- | ----------- | ----------- |
| showHours | `true`, `false` | `false` | Whether or not to show hours |
| leadingZeros | `hours`, `minutes`, `seconds` | `minutes` | Where to start showing leading zeros |