https://github.com/ppalone/duration-parser
https://github.com/ppalone/duration-parser
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ppalone/duration-parser
- Owner: ppalone
- Created: 2024-05-17T10:18:15.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-17T10:22:10.000Z (about 1 year ago)
- Last Synced: 2025-01-17T08:45:12.755Z (4 months ago)
- Language: Go
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Duration Parser
A small golang library to parse YouTube video duration format (eg `DD:HH:MM:SS`)
## How to get?
```
go get github.com/ppalone/duration-parser
```## Format
YouTube video duration format is `DD:HH:MM:SS` (For example `01:10:45:01`)
```
DD: Days
HH: Hours (must be less than or equal to 23)
MM: Minutes (must be less than or equal to 59)
SS: Seconds (must be less than or equal to 59)
```## Usage
```go
package mainimport (
"fmt"parser "github.com/ppalone/duration-parser"
)func main() {
s := "01:30"
d, _ := parser.Parse(s)
fmt.Println("Duration in seconds:", d.Seconds())
}
```