Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/timestamp-series
Get an array of timestamps between 2 points with a configurable resolution
https://github.com/binocarlos/timestamp-series
Last synced: 10 days ago
JSON representation
Get an array of timestamps between 2 points with a configurable resolution
- Host: GitHub
- URL: https://github.com/binocarlos/timestamp-series
- Owner: binocarlos
- License: mit
- Created: 2014-04-09T20:44:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-14T15:40:25.000Z (over 10 years ago)
- Last Synced: 2024-10-11T18:38:07.815Z (about 1 month ago)
- Language: JavaScript
- Size: 199 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
timestamp-series
================[![Travis](http://img.shields.io/travis/binocarlos/timestamp-series.svg?style=flat)](https://travis-ci.org/binocarlos/timestamp-series)
Get an array of timestamps between 2 points with a configurable resolution
## installation
```
$ npm install timestamp-series
```## usage
Give a start and end date with optional resolution and get back an array of timestamps between the start and end date.
The resolution is one of:
* year
* month
* day
* hour
* minute
* second
* millisecond```js
var timestampseries = require('timestamp-series');function get_day_series(){
var s = new Date('05/06/2014 12:00:00')
var e = new Date('05/12/2014 12:00:00')
return timestampseries('day', s, e);
}console.dir(get_day_series());
/*
[ 1399334400000,
1399420800000,
1399507200000,
1399593600000,
1399680000000,
1399766400000,
1399852800000,
1399939200000 ]
*/function get_year_series(){
var s = new Date('05/06/1994 12:00:00')
var e = new Date('05/12/2011 12:00:00')
return timestampseries('year', s, e);
}console.dir(get_year_series());
/*
[ 757382400000,
788940000000,
820497600000,
852055200000,
883612800000,
915170400000,
946728000000,
978285600000,
1009843200000,
1041400800000,
1072958400000,
1104516000000,
1136073600000,
1167631200000,
1199188800000,
1230746400000,
1262304000000,
1293861600000,
1325376000000 ]
*/
```## license
MIT