source: node_modules/postgres-interval/readme.md

main
Last change on this file was 62b2964, checked in by Klimentina Efremova <klimentina08642@…>, 2 weeks ago

Project Handcraft Marketplace

  • Property mode set to 100644
File size: 1.1 KB
Line 
1# postgres-interval [![Build Status](https://travis-ci.org/bendrucker/postgres-interval.svg?branch=master)](https://travis-ci.org/bendrucker/postgres-interval) [![Greenkeeper badge](https://badges.greenkeeper.io/bendrucker/postgres-interval.svg)](https://greenkeeper.io/)
2
3> Parse Postgres interval columns
4
5
6## Install
7
8```
9$ npm install --save postgres-interval
10```
11
12
13## Usage
14
15```js
16var parse = require('postgres-interval')
17var interval = parse('01:02:03')
18//=> {hours: 1, minutes: 2, seconds: 3}
19interval.toPostgres()
20// 3 seconds 2 minutes 1 hours
21interval.toISO()
22// P0Y0M0DT1H2M3S
23```
24
25## API
26
27#### `parse(pgInterval)` -> `interval`
28
29##### pgInterval
30
31*Required*
32Type: `string`
33
34A Postgres interval string.
35
36#### `interval.toPostgres()` -> `string`
37
38Returns an interval string. This allows the interval object to be passed into prepared statements.
39
40#### `interval.toISOString()` -> `string`
41
42Returns an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) compliant string.
43
44Also available as `interval.toISO()` for backwards compatibility.
45
46## License
47
48MIT © [Ben Drucker](http://bendrucker.me)
Note: See TracBrowser for help on using the repository browser.