Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 liveuser 1
# ms.js: miliseconds conversion utility
2
 
3
```js
4
ms('2 days')  // 172800000
5
ms('1d')      // 86400000
6
ms('10h')     // 36000000
7
ms('2.5 hrs') // 9000000
8
ms('2h')      // 7200000
9
ms('1m')      // 60000
10
ms('5s')      // 5000
11
ms('100')     // 100
12
```
13
 
14
```js
15
ms(60000)             // "1m"
16
ms(2 * 60000)         // "2m"
17
ms(ms('10 hours'))    // "10h"
18
```
19
 
20
```js
21
ms(60000, { long: true })             // "1 minute"
22
ms(2 * 60000, { long: true })         // "2 minutes"
23
ms(ms('10 hours'), { long: true })    // "10 hours"
24
```
25
 
26
- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download).
27
- If a number is supplied to `ms`, a string with a unit is returned.
28
- If a string that contains the number is supplied, it returns it as
29
a number (e.g: it returns `100` for `'100'`).
30
- If you pass a string with a number and a valid unit, the number of
31
equivalent ms is returned.
32
 
33
## License
34
 
35
MIT