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
- Host: GitHub
- URL: https://github.com/webdna/secondstohms
- Owner: webdna
- Created: 2015-03-11T14:37:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-11T15:02:44.000Z (over 11 years ago)
- Last Synced: 2024-12-24T22:03:26.983Z (over 1 year ago)
- Language: PHP
- Size: 133 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 |