UNPKG
sec
Version:
latest (2.0.0)
2.0.0
1.0.0
Convert a time string to seconds: `'00:22:17'` → `1337`
github.com/sindresorhus/sec
sindresorhus/sec
sec
/
readme.md
26 lines
(17 loc)
•
272 B
Markdown
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# sec
> Convert a time
string
to seconds: `
'00:22:17'
` → `
1337
`
## Install
``` $ npm install sec ```
## Usage
```js import toSeconds
from
'sec'
;
// hours:minutes:seconds
toSeconds(
'00:22:17'
);
//=> 1337
toSeconds(
'22:17'
);
//=> 1337
toSeconds(
'17'
);
//=> 17
```